@mayanfinance/swap-sdk
Advanced tools
Comparing version 2.7.0 to 2.8.0
@@ -81,7 +81,7 @@ define(['exports','cross-fetch','ethers','@solana/web3.js','@ethersproject/bytes','buffer','js-sha3','@solana/buffer-layout'],(function(exports,fetch,ethers,web3_js,bytes,buffer,jsSha3,bufferLayout){'use strict';var addresses = { | ||
} | ||
function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new web3_js.PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new web3_js.PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new web3_js.PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new web3_js.PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
if (!allowOwnerOffCurve && !web3_js.PublicKey.isOnCurve(owner.toBuffer())) { | ||
throw new Error('TokenOwnerOffCurveError'); | ||
} | ||
const [address] = web3_js.PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
const [address] = await web3_js.PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
return address; | ||
@@ -628,3 +628,3 @@ } | ||
const [mayanMainAccount] = await web3_js.PublicKey.findProgramAddress([Buffer.from('MAIN')], mayanProgram); | ||
const recipient = getAssociatedTokenAddress(new web3_js.PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const recipient = await getAssociatedTokenAddress(new web3_js.PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const amountIn = getAmountOfFractionalAmount(quote.effectiveAmountIn, quote.fromToken.decimals); | ||
@@ -785,6 +785,6 @@ const recipientHex = nativeAddressToHexString(recipient.toString(), 1); | ||
const auctionAddr = new web3_js.PublicKey(addresses.AUCTION_PROGRAM_ID); | ||
const [main, mainNonce] = web3_js.PublicKey.findProgramAddressSync([buffer.Buffer.from('MAIN')], mayanProgram); | ||
const [main, mainNonce] = await web3_js.PublicKey.findProgramAddress([buffer.Buffer.from('MAIN')], mayanProgram); | ||
const msg1 = web3_js.Keypair.generate(); | ||
const msg2 = web3_js.Keypair.generate(); | ||
const [state, stateNonce] = web3_js.PublicKey.findProgramAddressSync([ | ||
const [state, stateNonce] = await web3_js.PublicKey.findProgramAddress([ | ||
buffer.Buffer.from('V2STATE'), | ||
@@ -796,4 +796,4 @@ buffer.Buffer.from(msg1.publicKey.toBytes()), | ||
const toMint = new web3_js.PublicKey(quote.toToken.mint); | ||
const fromAccount = getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = getAssociatedTokenAddress(fromMint, main, true); | ||
const fromAccount = await getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = await getAssociatedTokenAddress(fromMint, main, true); | ||
const trx = new web3_js.Transaction({ | ||
@@ -896,3 +896,3 @@ feePayer: swapper, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new web3_js.Connection('https://rpc.ankr.com/solana'); | ||
const toAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const trx = new web3_js.Transaction({ | ||
@@ -918,3 +918,3 @@ feePayer: owner, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new web3_js.Connection('https://rpc.ankr.com/solana'); | ||
const fromAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const fromAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const delegate = web3_js.Keypair.generate(); | ||
@@ -924,3 +924,3 @@ const trx = new web3_js.Transaction({ | ||
}); | ||
const toAccount = getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
trx.add(createAssociatedTokenAccountInstruction(owner, toAccount, delegate.publicKey, solMint)); | ||
@@ -927,0 +927,0 @@ trx.add(createSplTransferInstruction(fromAccount, toAccount, owner, getAmountOfFractionalAmount(amount, 9))); |
@@ -81,7 +81,7 @@ 'use strict';var fetch=require('cross-fetch'),ethers=require('ethers'),web3_js=require('@solana/web3.js'),bytes=require('@ethersproject/bytes'),buffer=require('buffer'),jsSha3=require('js-sha3'),bufferLayout=require('@solana/buffer-layout');var addresses = { | ||
} | ||
function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new web3_js.PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new web3_js.PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new web3_js.PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new web3_js.PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
if (!allowOwnerOffCurve && !web3_js.PublicKey.isOnCurve(owner.toBuffer())) { | ||
throw new Error('TokenOwnerOffCurveError'); | ||
} | ||
const [address] = web3_js.PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
const [address] = await web3_js.PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
return address; | ||
@@ -628,3 +628,3 @@ } | ||
const [mayanMainAccount] = await web3_js.PublicKey.findProgramAddress([Buffer.from('MAIN')], mayanProgram); | ||
const recipient = getAssociatedTokenAddress(new web3_js.PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const recipient = await getAssociatedTokenAddress(new web3_js.PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const amountIn = getAmountOfFractionalAmount(quote.effectiveAmountIn, quote.fromToken.decimals); | ||
@@ -785,6 +785,6 @@ const recipientHex = nativeAddressToHexString(recipient.toString(), 1); | ||
const auctionAddr = new web3_js.PublicKey(addresses.AUCTION_PROGRAM_ID); | ||
const [main, mainNonce] = web3_js.PublicKey.findProgramAddressSync([buffer.Buffer.from('MAIN')], mayanProgram); | ||
const [main, mainNonce] = await web3_js.PublicKey.findProgramAddress([buffer.Buffer.from('MAIN')], mayanProgram); | ||
const msg1 = web3_js.Keypair.generate(); | ||
const msg2 = web3_js.Keypair.generate(); | ||
const [state, stateNonce] = web3_js.PublicKey.findProgramAddressSync([ | ||
const [state, stateNonce] = await web3_js.PublicKey.findProgramAddress([ | ||
buffer.Buffer.from('V2STATE'), | ||
@@ -796,4 +796,4 @@ buffer.Buffer.from(msg1.publicKey.toBytes()), | ||
const toMint = new web3_js.PublicKey(quote.toToken.mint); | ||
const fromAccount = getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = getAssociatedTokenAddress(fromMint, main, true); | ||
const fromAccount = await getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = await getAssociatedTokenAddress(fromMint, main, true); | ||
const trx = new web3_js.Transaction({ | ||
@@ -896,3 +896,3 @@ feePayer: swapper, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new web3_js.Connection('https://rpc.ankr.com/solana'); | ||
const toAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const trx = new web3_js.Transaction({ | ||
@@ -918,3 +918,3 @@ feePayer: owner, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new web3_js.Connection('https://rpc.ankr.com/solana'); | ||
const fromAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const fromAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const delegate = web3_js.Keypair.generate(); | ||
@@ -924,3 +924,3 @@ const trx = new web3_js.Transaction({ | ||
}); | ||
const toAccount = getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
trx.add(createAssociatedTokenAccountInstruction(owner, toAccount, delegate.publicKey, solMint)); | ||
@@ -927,0 +927,0 @@ trx.add(createSplTransferInstruction(fromAccount, toAccount, owner, getAmountOfFractionalAmount(amount, 9))); |
@@ -81,7 +81,7 @@ import fetch from'cross-fetch';import {ethers}from'ethers';import {PublicKey,Connection,Keypair,Transaction,SystemProgram,SYSVAR_CLOCK_PUBKEY,SYSVAR_RENT_PUBKEY,TransactionInstruction}from'@solana/web3.js';import {zeroPad}from'@ethersproject/bytes';import {Buffer as Buffer$1}from'buffer';import {sha3_256}from'js-sha3';import {struct,u8,nu64,u16,blob}from'@solana/buffer-layout';var addresses = { | ||
} | ||
function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer())) { | ||
throw new Error('TokenOwnerOffCurveError'); | ||
} | ||
const [address] = PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
const [address] = await PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
return address; | ||
@@ -628,3 +628,3 @@ } | ||
const [mayanMainAccount] = await PublicKey.findProgramAddress([Buffer.from('MAIN')], mayanProgram); | ||
const recipient = getAssociatedTokenAddress(new PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const recipient = await getAssociatedTokenAddress(new PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const amountIn = getAmountOfFractionalAmount(quote.effectiveAmountIn, quote.fromToken.decimals); | ||
@@ -785,6 +785,6 @@ const recipientHex = nativeAddressToHexString(recipient.toString(), 1); | ||
const auctionAddr = new PublicKey(addresses.AUCTION_PROGRAM_ID); | ||
const [main, mainNonce] = PublicKey.findProgramAddressSync([Buffer$1.from('MAIN')], mayanProgram); | ||
const [main, mainNonce] = await PublicKey.findProgramAddress([Buffer$1.from('MAIN')], mayanProgram); | ||
const msg1 = Keypair.generate(); | ||
const msg2 = Keypair.generate(); | ||
const [state, stateNonce] = PublicKey.findProgramAddressSync([ | ||
const [state, stateNonce] = await PublicKey.findProgramAddress([ | ||
Buffer$1.from('V2STATE'), | ||
@@ -796,4 +796,4 @@ Buffer$1.from(msg1.publicKey.toBytes()), | ||
const toMint = new PublicKey(quote.toToken.mint); | ||
const fromAccount = getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = getAssociatedTokenAddress(fromMint, main, true); | ||
const fromAccount = await getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = await getAssociatedTokenAddress(fromMint, main, true); | ||
const trx = new Transaction({ | ||
@@ -896,3 +896,3 @@ feePayer: swapper, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new Connection('https://rpc.ankr.com/solana'); | ||
const toAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const trx = new Transaction({ | ||
@@ -918,3 +918,3 @@ feePayer: owner, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new Connection('https://rpc.ankr.com/solana'); | ||
const fromAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const fromAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const delegate = Keypair.generate(); | ||
@@ -924,3 +924,3 @@ const trx = new Transaction({ | ||
}); | ||
const toAccount = getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
trx.add(createAssociatedTokenAccountInstruction(owner, toAccount, delegate.publicKey, solMint)); | ||
@@ -927,0 +927,0 @@ trx.add(createSplTransferInstruction(fromAccount, toAccount, owner, getAmountOfFractionalAmount(amount, 9))); |
@@ -81,7 +81,7 @@ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports,require('cross-fetch'),require('ethers'),require('@solana/web3.js'),require('@ethersproject/bytes'),require('buffer'),require('js-sha3'),require('@solana/buffer-layout')):typeof define==='function'&&define.amd?define(['exports','cross-fetch','ethers','@solana/web3.js','@ethersproject/bytes','buffer','js-sha3','@solana/buffer-layout'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.MAYAN={},g.fetch,g.ethers,g.web3_js,g.bytes,g.buffer,g.jsSha3,g.bufferLayout));})(this,(function(exports,fetch,ethers,web3_js,bytes,buffer,jsSha3,bufferLayout){'use strict';var addresses = { | ||
} | ||
function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new web3_js.PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new web3_js.PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new web3_js.PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new web3_js.PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
if (!allowOwnerOffCurve && !web3_js.PublicKey.isOnCurve(owner.toBuffer())) { | ||
throw new Error('TokenOwnerOffCurveError'); | ||
} | ||
const [address] = web3_js.PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
const [address] = await web3_js.PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
return address; | ||
@@ -628,3 +628,3 @@ } | ||
const [mayanMainAccount] = await web3_js.PublicKey.findProgramAddress([Buffer.from('MAIN')], mayanProgram); | ||
const recipient = getAssociatedTokenAddress(new web3_js.PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const recipient = await getAssociatedTokenAddress(new web3_js.PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const amountIn = getAmountOfFractionalAmount(quote.effectiveAmountIn, quote.fromToken.decimals); | ||
@@ -785,6 +785,6 @@ const recipientHex = nativeAddressToHexString(recipient.toString(), 1); | ||
const auctionAddr = new web3_js.PublicKey(addresses.AUCTION_PROGRAM_ID); | ||
const [main, mainNonce] = web3_js.PublicKey.findProgramAddressSync([buffer.Buffer.from('MAIN')], mayanProgram); | ||
const [main, mainNonce] = await web3_js.PublicKey.findProgramAddress([buffer.Buffer.from('MAIN')], mayanProgram); | ||
const msg1 = web3_js.Keypair.generate(); | ||
const msg2 = web3_js.Keypair.generate(); | ||
const [state, stateNonce] = web3_js.PublicKey.findProgramAddressSync([ | ||
const [state, stateNonce] = await web3_js.PublicKey.findProgramAddress([ | ||
buffer.Buffer.from('V2STATE'), | ||
@@ -796,4 +796,4 @@ buffer.Buffer.from(msg1.publicKey.toBytes()), | ||
const toMint = new web3_js.PublicKey(quote.toToken.mint); | ||
const fromAccount = getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = getAssociatedTokenAddress(fromMint, main, true); | ||
const fromAccount = await getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = await getAssociatedTokenAddress(fromMint, main, true); | ||
const trx = new web3_js.Transaction({ | ||
@@ -896,3 +896,3 @@ feePayer: swapper, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new web3_js.Connection('https://rpc.ankr.com/solana'); | ||
const toAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const trx = new web3_js.Transaction({ | ||
@@ -918,3 +918,3 @@ feePayer: owner, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new web3_js.Connection('https://rpc.ankr.com/solana'); | ||
const fromAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const fromAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const delegate = web3_js.Keypair.generate(); | ||
@@ -924,3 +924,3 @@ const trx = new web3_js.Transaction({ | ||
}); | ||
const toAccount = getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
trx.add(createAssociatedTokenAccountInstruction(owner, toAccount, delegate.publicKey, solMint)); | ||
@@ -927,0 +927,0 @@ trx.add(createSplTransferInstruction(fromAccount, toAccount, owner, getAmountOfFractionalAmount(amount, 9))); |
@@ -10,3 +10,3 @@ import { ethers } from 'ethers'; | ||
const [mayanMainAccount] = await PublicKey.findProgramAddress([Buffer.from('MAIN')], mayanProgram); | ||
const recipient = getAssociatedTokenAddress(new PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const recipient = await getAssociatedTokenAddress(new PublicKey(quote.fromToken.mint), mayanMainAccount, true); | ||
const amountIn = getAmountOfFractionalAmount(quote.effectiveAmountIn, quote.fromToken.decimals); | ||
@@ -13,0 +13,0 @@ const recipientHex = nativeAddressToHexString(recipient.toString(), 1); |
@@ -104,6 +104,6 @@ import { Connection, PublicKey, Keypair, SystemProgram, SYSVAR_CLOCK_PUBKEY, SYSVAR_RENT_PUBKEY, Transaction, TransactionInstruction, } from '@solana/web3.js'; | ||
const auctionAddr = new PublicKey(addresses.AUCTION_PROGRAM_ID); | ||
const [main, mainNonce] = PublicKey.findProgramAddressSync([Buffer.from('MAIN')], mayanProgram); | ||
const [main, mainNonce] = await PublicKey.findProgramAddress([Buffer.from('MAIN')], mayanProgram); | ||
const msg1 = Keypair.generate(); | ||
const msg2 = Keypair.generate(); | ||
const [state, stateNonce] = PublicKey.findProgramAddressSync([ | ||
const [state, stateNonce] = await PublicKey.findProgramAddress([ | ||
Buffer.from('V2STATE'), | ||
@@ -115,4 +115,4 @@ Buffer.from(msg1.publicKey.toBytes()), | ||
const toMint = new PublicKey(quote.toToken.mint); | ||
const fromAccount = getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = getAssociatedTokenAddress(fromMint, main, true); | ||
const fromAccount = await getAssociatedTokenAddress(fromMint, swapper); | ||
const toAccount = await getAssociatedTokenAddress(fromMint, main, true); | ||
const trx = new Transaction({ | ||
@@ -215,3 +215,3 @@ feePayer: swapper, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new Connection('https://rpc.ankr.com/solana'); | ||
const toAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const trx = new Transaction({ | ||
@@ -237,3 +237,3 @@ feePayer: owner, | ||
const solanaConnection = connection !== null && connection !== void 0 ? connection : new Connection('https://rpc.ankr.com/solana'); | ||
const fromAccount = getAssociatedTokenAddress(solMint, owner, false); | ||
const fromAccount = await getAssociatedTokenAddress(solMint, owner, false); | ||
const delegate = Keypair.generate(); | ||
@@ -243,3 +243,3 @@ const trx = new Transaction({ | ||
}); | ||
const toAccount = getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
const toAccount = await getAssociatedTokenAddress(solMint, delegate.publicKey, false); | ||
trx.add(createAssociatedTokenAccountInstruction(owner, toAccount, delegate.publicKey, solMint)); | ||
@@ -246,0 +246,0 @@ trx.add(createSplTransferInstruction(fromAccount, toAccount, owner, getAmountOfFractionalAmount(amount, 9))); |
@@ -7,3 +7,3 @@ import { ethers } from 'ethers'; | ||
export declare function getCurrentEvmTime(provider: ethers.providers.BaseProvider): Promise<number>; | ||
export declare function getAssociatedTokenAddress(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey; | ||
export declare function getAssociatedTokenAddress(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<PublicKey>; | ||
export declare function getAmountOfFractionalAmount(amount: string | number, decimals: string | number): ethers.BigNumber; | ||
@@ -10,0 +10,0 @@ export declare function getDisplayAmount(inputAmount: ethers.BigNumberish, decimals: string | ethers.BigNumberish): number; |
@@ -37,7 +37,7 @@ import { zeroPad } from '@ethersproject/bytes'; | ||
} | ||
export function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
export async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = new PublicKey(addresses.TOKEN_PROGRAM_ID), associatedTokenProgramId = new PublicKey(addresses.ASSOCIATED_TOKEN_PROGRAM_ID)) { | ||
if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer())) { | ||
throw new Error('TokenOwnerOffCurveError'); | ||
} | ||
const [address] = PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
const [address] = await PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId); | ||
return address; | ||
@@ -44,0 +44,0 @@ } |
{ | ||
"name": "@mayanfinance/swap-sdk", | ||
"description": "A SDK to swap with Mayan", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"source": "src/main.ts", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
205455
20