@saberhq/token-utils
Advanced tools
Comparing version 0.14.2 to 0.14.3
@@ -10,3 +10,3 @@ "use strict"; | ||
*/ | ||
const getATAAddress = ({ mint, owner, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const getATAAddress = ({ mint, owner, }) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
const [address] = yield web3_js_1.PublicKey.findProgramAddress([owner.toBuffer(), spl_token_1.TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()], spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID); | ||
@@ -19,6 +19,6 @@ return address; | ||
*/ | ||
const getATAAddresses = ({ mints, owner, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const result = yield Promise.all(Object.entries(mints).map((args) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const getATAAddresses = ({ mints, owner, }) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
const result = yield Promise.all(Object.entries(mints).map((args) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
const [name, mint] = args; | ||
const result = yield exports.getATAAddress({ | ||
const result = yield (0, exports.getATAAddress)({ | ||
mint, | ||
@@ -25,0 +25,0 @@ owner: owner, |
@@ -5,8 +5,8 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./ata"), exports); | ||
tslib_1.__exportStar(require("./instructions"), exports); | ||
tslib_1.__exportStar(require("./layout"), exports); | ||
tslib_1.__exportStar(require("./price"), exports); | ||
tslib_1.__exportStar(require("./token"), exports); | ||
tslib_1.__exportStar(require("./tokenAmount"), exports); | ||
(0, tslib_1.__exportStar)(require("./ata"), exports); | ||
(0, tslib_1.__exportStar)(require("./instructions"), exports); | ||
(0, tslib_1.__exportStar)(require("./layout"), exports); | ||
(0, tslib_1.__exportStar)(require("./price"), exports); | ||
(0, tslib_1.__exportStar)(require("./token"), exports); | ||
(0, tslib_1.__exportStar)(require("./tokenAmount"), exports); | ||
// re-export token-math types | ||
@@ -13,0 +13,0 @@ // so consumers don't need to use them |
@@ -8,3 +8,3 @@ "use strict"; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const createTokenAccount = ({ provider, mint, owner = provider.wallet.publicKey, payer = provider.wallet.publicKey, accountSigner = web3_js_1.Keypair.generate(), }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const createTokenAccount = ({ provider, mint, owner = provider.wallet.publicKey, payer = provider.wallet.publicKey, accountSigner = web3_js_1.Keypair.generate(), }) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
// Allocate memory for the account | ||
@@ -11,0 +11,0 @@ const balanceNeeded = yield spl_token_1.Token.getMinBalanceRentForExemptAccount(provider.connection); |
@@ -13,4 +13,4 @@ "use strict"; | ||
*/ | ||
const getOrCreateATA = ({ provider, mint, owner = provider.wallet.publicKey, payer = provider.wallet.publicKey, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const address = yield ata_1.getATAAddress({ mint, owner }); | ||
const getOrCreateATA = ({ provider, mint, owner = provider.wallet.publicKey, payer = provider.wallet.publicKey, }) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
const address = yield (0, ata_1.getATAAddress)({ mint, owner }); | ||
if (yield provider.connection.getAccountInfo(address)) { | ||
@@ -22,3 +22,3 @@ return { address, instruction: null }; | ||
address, | ||
instruction: exports.createATAInstruction({ | ||
instruction: (0, exports.createATAInstruction)({ | ||
mint, | ||
@@ -38,6 +38,6 @@ address, | ||
*/ | ||
const getOrCreateATAs = ({ provider, mints, owner = provider.wallet.publicKey, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const result = yield Promise.all(Object.entries(mints).map(([name, mint]) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const getOrCreateATAs = ({ provider, mints, owner = provider.wallet.publicKey, }) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
const result = yield Promise.all(Object.entries(mints).map(([name, mint]) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
const mintKey = new web3_js_1.PublicKey(mint); | ||
const result = yield exports.getOrCreateATA({ | ||
const result = yield (0, exports.getOrCreateATA)({ | ||
provider, | ||
@@ -44,0 +44,0 @@ mint: mintKey, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./account"), exports); | ||
tslib_1.__exportStar(require("./ata"), exports); | ||
tslib_1.__exportStar(require("./mint"), exports); | ||
(0, tslib_1.__exportStar)(require("./account"), exports); | ||
(0, tslib_1.__exportStar)(require("./ata"), exports); | ||
(0, tslib_1.__exportStar)(require("./mint"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -13,3 +13,3 @@ "use strict"; | ||
*/ | ||
const createInitMintInstructions = ({ provider, mintKP, decimals, mintAuthority = provider.wallet.publicKey, freezeAuthority = null, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const createInitMintInstructions = ({ provider, mintKP, decimals, mintAuthority = provider.wallet.publicKey, freezeAuthority = null, }) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
const from = provider.wallet.publicKey; | ||
@@ -16,0 +16,0 @@ return new solana_contrib_1.TransactionEnvelope(provider, [ |
@@ -7,3 +7,3 @@ "use strict"; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const BufferLayout = tslib_1.__importStar(require("buffer-layout")); | ||
const BufferLayout = (0, tslib_1.__importStar)(require("buffer-layout")); | ||
/** | ||
@@ -10,0 +10,0 @@ * Layout for a public key |
@@ -14,3 +14,3 @@ "use strict"; | ||
this.mintAccount = new web3_js_1.PublicKey(info.address); | ||
this.network = (_a = exports.chainIdToNetwork(info.chainId)) !== null && _a !== void 0 ? _a : "localnet"; | ||
this.network = (_a = (0, exports.chainIdToNetwork)(info.chainId)) !== null && _a !== void 0 ? _a : "localnet"; | ||
} | ||
@@ -36,3 +36,3 @@ get chainId() { | ||
equals(other) { | ||
return exports.tokensEqual(this, other); | ||
return (0, exports.tokensEqual)(this, other); | ||
} | ||
@@ -115,3 +115,3 @@ toString() { | ||
*/ | ||
exports.SOL = exports.makeTokenForAllNetworks(sol); | ||
exports.SOL = (0, exports.makeTokenForAllNetworks)(sol); | ||
//# sourceMappingURL=token.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
super(token, amount); | ||
token_math_1.validateU64(this.raw); | ||
(0, token_math_1.validateU64)(this.raw); | ||
} | ||
@@ -13,0 +13,0 @@ /** |
{ | ||
"name": "@saberhq/token-utils", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"repository": "git@github.com:saber-hq/solana-common.git", | ||
@@ -15,3 +15,3 @@ "author": "Ian Macalinao <ian@saber.so>", | ||
"@solana/spl-token": "^0.1.5", | ||
"@solana/spl-token-registry": "^0.2.210", | ||
"@solana/spl-token-registry": "^0.2.223", | ||
"@solana/web3.js": "^1.23.0", | ||
@@ -34,3 +34,3 @@ "@ubeswap/token-math": "^4.1.0", | ||
}, | ||
"gitHead": "8a4f20bf700337b8c769e5f144243792015bd63d" | ||
"gitHead": "fc2dbbb559f5535f137455a53084adc943235f55" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81730