@sodax/sdk 2.0.0-rc.10 → 2.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +24 -5
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +25 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -4013,7 +4013,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
4013
4013
|
}
|
|
4014
4014
|
|
|
4015
4015
|
// ../types/dist/index.js
|
|
4016
|
-
var CONFIG_VERSION =
|
|
4016
|
+
var CONFIG_VERSION = 209;
|
|
4017
4017
|
function isEvmSpokeChainConfig(value) {
|
|
4018
4018
|
return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
|
|
4019
4019
|
}
|
|
@@ -22940,7 +22940,12 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
22940
22940
|
}
|
|
22941
22941
|
]).instruction();
|
|
22942
22942
|
} else {
|
|
22943
|
-
const
|
|
22943
|
+
const tokenProgramId = await _SolanaSpokeService.getMintTokenProgramId(this.connection, token);
|
|
22944
|
+
const signerTokenAccount = await _SolanaSpokeService.getAssociatedTokenAddress(
|
|
22945
|
+
token.toBase58(),
|
|
22946
|
+
walletAddress,
|
|
22947
|
+
tokenProgramId
|
|
22948
|
+
);
|
|
22944
22949
|
depositInstruction = await assetManagerProgram.methods.transfer(amountBN, Buffer.from(recipient.slice(2), "hex"), Buffer.from(data.slice(2), "hex")).accountsStrict({
|
|
22945
22950
|
signer: walletPublicKey,
|
|
22946
22951
|
systemProgram: web3_js.SystemProgram.programId,
|
|
@@ -22951,7 +22956,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
22951
22956
|
authority: AssetManagerPDA.authority(assetManagerProgram.programId).pda,
|
|
22952
22957
|
mint: token,
|
|
22953
22958
|
connection: connectionProgram.programId,
|
|
22954
|
-
tokenProgram:
|
|
22959
|
+
tokenProgram: tokenProgramId
|
|
22955
22960
|
}).remainingAccounts([
|
|
22956
22961
|
{
|
|
22957
22962
|
pubkey: ConnectionConfigPDA.config(connectionProgram.programId).pda,
|
|
@@ -23090,8 +23095,22 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
23090
23095
|
static async getTokenAccountBalance(connection, publicKey) {
|
|
23091
23096
|
return await connection.getTokenAccountBalance(new web3_js.PublicKey(publicKey));
|
|
23092
23097
|
}
|
|
23093
|
-
|
|
23094
|
-
|
|
23098
|
+
/**
|
|
23099
|
+
* Resolves the token program that owns a mint (legacy SPL Token vs Token-2022). Falls back to
|
|
23100
|
+
* the legacy SPL Token program when the mint account can't be read.
|
|
23101
|
+
*/
|
|
23102
|
+
static async getMintTokenProgramId(connection, mint) {
|
|
23103
|
+
const mintAccountInfo = await connection.getAccountInfo(mint);
|
|
23104
|
+
return mintAccountInfo?.owner.equals(splToken.TOKEN_2022_PROGRAM_ID) ? splToken.TOKEN_2022_PROGRAM_ID : splToken.TOKEN_PROGRAM_ID;
|
|
23105
|
+
}
|
|
23106
|
+
static async getAssociatedTokenAddress(mint, walletAddress, tokenProgramId = splToken.TOKEN_PROGRAM_ID) {
|
|
23107
|
+
const ata = await splToken.getAssociatedTokenAddress(
|
|
23108
|
+
new web3_js.PublicKey(mint),
|
|
23109
|
+
new web3_js.PublicKey(walletAddress),
|
|
23110
|
+
true,
|
|
23111
|
+
tokenProgramId
|
|
23112
|
+
);
|
|
23113
|
+
return ata.toBase58();
|
|
23095
23114
|
}
|
|
23096
23115
|
static buildTransactionInstruction(rawInstructions) {
|
|
23097
23116
|
return rawInstructions.map(
|
package/dist/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ import { JsonRpcProvider } from 'near-api-js';
|
|
|
8
8
|
import { Transaction, TransactionResult } from '@mysten/sui/transactions';
|
|
9
9
|
import { SuiClient } from '@mysten/sui/client';
|
|
10
10
|
import { rpc, Transaction as Transaction$1, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Account, xdr } from '@stellar/stellar-sdk';
|
|
11
|
-
import { Connection as Connection$1,
|
|
11
|
+
import { Connection as Connection$1, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
12
12
|
import { IconService } from 'icon-sdk-js';
|
|
13
13
|
import { ChainGrpcWasmApi, TxGrpcApi } from '@injectivelabs/sdk-ts';
|
|
14
14
|
import { NetworkEndpoints } from '@injectivelabs/networks';
|
|
@@ -9279,7 +9279,12 @@ declare class SolanaSpokeService {
|
|
|
9279
9279
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<SolanaChainKey>): Promise<Result<WaitForTxReceiptReturnType<SolanaChainKey>>>;
|
|
9280
9280
|
static getBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<number>;
|
|
9281
9281
|
static getTokenAccountBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
|
|
9282
|
-
|
|
9282
|
+
/**
|
|
9283
|
+
* Resolves the token program that owns a mint (legacy SPL Token vs Token-2022). Falls back to
|
|
9284
|
+
* the legacy SPL Token program when the mint account can't be read.
|
|
9285
|
+
*/
|
|
9286
|
+
static getMintTokenProgramId(connection: Connection$1, mint: PublicKey): Promise<PublicKey>;
|
|
9287
|
+
static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey, tokenProgramId?: PublicKey): Promise<SolanaBase58PublicKey>;
|
|
9283
9288
|
static buildTransactionInstruction(rawInstructions: SolanaRawTransactionInstruction[]): TransactionInstruction[];
|
|
9284
9289
|
}
|
|
9285
9290
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { JsonRpcProvider } from 'near-api-js';
|
|
|
8
8
|
import { Transaction, TransactionResult } from '@mysten/sui/transactions';
|
|
9
9
|
import { SuiClient } from '@mysten/sui/client';
|
|
10
10
|
import { rpc, Transaction as Transaction$1, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Account, xdr } from '@stellar/stellar-sdk';
|
|
11
|
-
import { Connection as Connection$1,
|
|
11
|
+
import { Connection as Connection$1, PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
12
12
|
import { IconService } from 'icon-sdk-js';
|
|
13
13
|
import { ChainGrpcWasmApi, TxGrpcApi } from '@injectivelabs/sdk-ts';
|
|
14
14
|
import { NetworkEndpoints } from '@injectivelabs/networks';
|
|
@@ -9279,7 +9279,12 @@ declare class SolanaSpokeService {
|
|
|
9279
9279
|
waitForTransactionReceipt(params: WaitForTxReceiptParams<SolanaChainKey>): Promise<Result<WaitForTxReceiptReturnType<SolanaChainKey>>>;
|
|
9280
9280
|
static getBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<number>;
|
|
9281
9281
|
static getTokenAccountBalance(connection: Connection$1, publicKey: SolanaBase58PublicKey): Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
|
|
9282
|
-
|
|
9282
|
+
/**
|
|
9283
|
+
* Resolves the token program that owns a mint (legacy SPL Token vs Token-2022). Falls back to
|
|
9284
|
+
* the legacy SPL Token program when the mint account can't be read.
|
|
9285
|
+
*/
|
|
9286
|
+
static getMintTokenProgramId(connection: Connection$1, mint: PublicKey): Promise<PublicKey>;
|
|
9287
|
+
static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey, tokenProgramId?: PublicKey): Promise<SolanaBase58PublicKey>;
|
|
9283
9288
|
static buildTransactionInstruction(rawInstructions: SolanaRawTransactionInstruction[]): TransactionInstruction[];
|
|
9284
9289
|
}
|
|
9285
9290
|
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import * as ecc from '@bitcoinerlab/secp256k1';
|
|
|
10
10
|
import { CLPositionManagerAbi, encodeCLPositionManagerMintCalldata, encodeCLPositionManagerIncreaseLiquidityCalldata, encodeCLPositionManagerDecreaseLiquidityCalldata, getPoolId, CLPoolManagerAbi, decodePoolKey } from '@pancakeswap/infinity-sdk';
|
|
11
11
|
import { Transaction as Transaction$1 } from '@mysten/sui/transactions';
|
|
12
12
|
import { SuiClient } from '@mysten/sui/client';
|
|
13
|
-
import { TOKEN_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
|
|
13
|
+
import { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
|
|
14
14
|
import { AnchorProvider, Program } from '@coral-xyz/anchor';
|
|
15
15
|
import BN from 'bn.js';
|
|
16
16
|
import * as IconSdkRaw from 'icon-sdk-js';
|
|
@@ -3985,7 +3985,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
3985
3985
|
}
|
|
3986
3986
|
|
|
3987
3987
|
// ../types/dist/index.js
|
|
3988
|
-
var CONFIG_VERSION =
|
|
3988
|
+
var CONFIG_VERSION = 209;
|
|
3989
3989
|
function isEvmSpokeChainConfig(value) {
|
|
3990
3990
|
return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
|
|
3991
3991
|
}
|
|
@@ -22912,7 +22912,12 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
22912
22912
|
}
|
|
22913
22913
|
]).instruction();
|
|
22914
22914
|
} else {
|
|
22915
|
-
const
|
|
22915
|
+
const tokenProgramId = await _SolanaSpokeService.getMintTokenProgramId(this.connection, token);
|
|
22916
|
+
const signerTokenAccount = await _SolanaSpokeService.getAssociatedTokenAddress(
|
|
22917
|
+
token.toBase58(),
|
|
22918
|
+
walletAddress,
|
|
22919
|
+
tokenProgramId
|
|
22920
|
+
);
|
|
22916
22921
|
depositInstruction = await assetManagerProgram.methods.transfer(amountBN, Buffer.from(recipient.slice(2), "hex"), Buffer.from(data.slice(2), "hex")).accountsStrict({
|
|
22917
22922
|
signer: walletPublicKey,
|
|
22918
22923
|
systemProgram: SystemProgram.programId,
|
|
@@ -22923,7 +22928,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
22923
22928
|
authority: AssetManagerPDA.authority(assetManagerProgram.programId).pda,
|
|
22924
22929
|
mint: token,
|
|
22925
22930
|
connection: connectionProgram.programId,
|
|
22926
|
-
tokenProgram:
|
|
22931
|
+
tokenProgram: tokenProgramId
|
|
22927
22932
|
}).remainingAccounts([
|
|
22928
22933
|
{
|
|
22929
22934
|
pubkey: ConnectionConfigPDA.config(connectionProgram.programId).pda,
|
|
@@ -23062,8 +23067,22 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
23062
23067
|
static async getTokenAccountBalance(connection, publicKey) {
|
|
23063
23068
|
return await connection.getTokenAccountBalance(new PublicKey(publicKey));
|
|
23064
23069
|
}
|
|
23065
|
-
|
|
23066
|
-
|
|
23070
|
+
/**
|
|
23071
|
+
* Resolves the token program that owns a mint (legacy SPL Token vs Token-2022). Falls back to
|
|
23072
|
+
* the legacy SPL Token program when the mint account can't be read.
|
|
23073
|
+
*/
|
|
23074
|
+
static async getMintTokenProgramId(connection, mint) {
|
|
23075
|
+
const mintAccountInfo = await connection.getAccountInfo(mint);
|
|
23076
|
+
return mintAccountInfo?.owner.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
|
|
23077
|
+
}
|
|
23078
|
+
static async getAssociatedTokenAddress(mint, walletAddress, tokenProgramId = TOKEN_PROGRAM_ID) {
|
|
23079
|
+
const ata = await getAssociatedTokenAddress(
|
|
23080
|
+
new PublicKey(mint),
|
|
23081
|
+
new PublicKey(walletAddress),
|
|
23082
|
+
true,
|
|
23083
|
+
tokenProgramId
|
|
23084
|
+
);
|
|
23085
|
+
return ata.toBase58();
|
|
23067
23086
|
}
|
|
23068
23087
|
static buildTransactionInstruction(rawInstructions) {
|
|
23069
23088
|
return rawInstructions.map(
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "2.0.0-rc.
|
|
7
|
+
"version": "2.0.0-rc.11",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"description": "Sodax SDK",
|
|
10
10
|
"keywords": [
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"near-api-js": "7.2.0",
|
|
66
66
|
"rlp": "3.0.0",
|
|
67
67
|
"viem": "2.29.2",
|
|
68
|
-
"@sodax/
|
|
69
|
-
"@sodax/
|
|
68
|
+
"@sodax/libs": "2.0.0-rc.11",
|
|
69
|
+
"@sodax/types": "2.0.0-rc.11"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@arethetypeswrong/cli": "0.17.4",
|