@sodax/sdk 0.0.1-rc.14 → 0.0.1-rc.15
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/README.md +2 -2
- package/dist/index.cjs +10 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.mjs +10 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -6305,7 +6305,6 @@ type SolanaChainConfig = BaseSpokeChainConfig<'SOLANA'> & {
|
|
|
6305
6305
|
};
|
|
6306
6306
|
chain: SpokeChainInfo<'SOLANA'>;
|
|
6307
6307
|
rpcUrl: string;
|
|
6308
|
-
wsUrl: string;
|
|
6309
6308
|
walletAddress: string;
|
|
6310
6309
|
nativeToken: string;
|
|
6311
6310
|
gasPrice: string;
|
|
@@ -6785,8 +6784,7 @@ declare const spokeChainConfig: {
|
|
|
6785
6784
|
};
|
|
6786
6785
|
};
|
|
6787
6786
|
readonly gasPrice: "500000";
|
|
6788
|
-
readonly rpcUrl: "https://
|
|
6789
|
-
readonly wsUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5";
|
|
6787
|
+
readonly rpcUrl: "https://api.mainnet-beta.solana.com";
|
|
6790
6788
|
readonly walletAddress: "";
|
|
6791
6789
|
};
|
|
6792
6790
|
readonly "0xa86a.avax": {
|
package/dist/index.d.ts
CHANGED
|
@@ -6305,7 +6305,6 @@ type SolanaChainConfig = BaseSpokeChainConfig<'SOLANA'> & {
|
|
|
6305
6305
|
};
|
|
6306
6306
|
chain: SpokeChainInfo<'SOLANA'>;
|
|
6307
6307
|
rpcUrl: string;
|
|
6308
|
-
wsUrl: string;
|
|
6309
6308
|
walletAddress: string;
|
|
6310
6309
|
nativeToken: string;
|
|
6311
6310
|
gasPrice: string;
|
|
@@ -6785,8 +6784,7 @@ declare const spokeChainConfig: {
|
|
|
6785
6784
|
};
|
|
6786
6785
|
};
|
|
6787
6786
|
readonly gasPrice: "500000";
|
|
6788
|
-
readonly rpcUrl: "https://
|
|
6789
|
-
readonly wsUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5";
|
|
6787
|
+
readonly rpcUrl: "https://api.mainnet-beta.solana.com";
|
|
6790
6788
|
readonly walletAddress: "";
|
|
6791
6789
|
};
|
|
6792
6790
|
readonly "0xa86a.avax": {
|
package/dist/index.mjs
CHANGED
|
@@ -5259,8 +5259,7 @@ var spokeChainConfig = {
|
|
|
5259
5259
|
}
|
|
5260
5260
|
},
|
|
5261
5261
|
gasPrice: "500000",
|
|
5262
|
-
rpcUrl: "https://
|
|
5263
|
-
wsUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5",
|
|
5262
|
+
rpcUrl: "https://api.mainnet-beta.solana.com",
|
|
5264
5263
|
walletAddress: ""
|
|
5265
5264
|
},
|
|
5266
5265
|
[AVALANCHE_MAINNET_CHAIN_ID]: {
|
|
@@ -6819,16 +6818,7 @@ var InjectiveSpokeProvider = class {
|
|
|
6819
6818
|
return this.transfer(sender, token, to, amount, data, funds, raw);
|
|
6820
6819
|
}
|
|
6821
6820
|
async isNative(token) {
|
|
6822
|
-
|
|
6823
|
-
const injective20Token = new Injective20Token(this.walletProvider, token);
|
|
6824
|
-
try {
|
|
6825
|
-
await injective20Token.getTokenInfo();
|
|
6826
|
-
isNative2 = false;
|
|
6827
|
-
} catch (err) {
|
|
6828
|
-
console.error("[InjectiveSpokeProvider] isNative error", err);
|
|
6829
|
-
throw err;
|
|
6830
|
-
}
|
|
6831
|
-
return isNative2;
|
|
6821
|
+
return token === "inj";
|
|
6832
6822
|
}
|
|
6833
6823
|
async receiveMessage(senderAddress, srcChainId, srcAddress, connSn, payload, signatures) {
|
|
6834
6824
|
const msg = {
|
|
@@ -9707,15 +9697,13 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
9707
9697
|
});
|
|
9708
9698
|
}
|
|
9709
9699
|
};
|
|
9710
|
-
async function getProvider(base58PublicKey, rpcUrl
|
|
9700
|
+
async function getProvider(base58PublicKey, rpcUrl) {
|
|
9711
9701
|
const wallet = {
|
|
9712
9702
|
publicKey: new PublicKey(base58PublicKey),
|
|
9713
9703
|
signTransaction: () => Promise.reject(),
|
|
9714
9704
|
signAllTransactions: () => Promise.reject()
|
|
9715
9705
|
};
|
|
9716
|
-
const connection = new Connection(rpcUrl
|
|
9717
|
-
wsEndpoint: wsUrl
|
|
9718
|
-
});
|
|
9706
|
+
const connection = new Connection(rpcUrl);
|
|
9719
9707
|
return new anchor.AnchorProvider(connection, wallet, { commitment: "confirmed" });
|
|
9720
9708
|
}
|
|
9721
9709
|
async function getAssetManagerIdl(assetManager, provider) {
|
|
@@ -9742,13 +9730,13 @@ async function getConnectionIdl(connection, provider) {
|
|
|
9742
9730
|
throw err;
|
|
9743
9731
|
}
|
|
9744
9732
|
}
|
|
9745
|
-
async function getAssetManagerProgram(base58PublicKey, rpcUrl,
|
|
9746
|
-
const provider = await getProvider(base58PublicKey, rpcUrl
|
|
9733
|
+
async function getAssetManagerProgram(base58PublicKey, rpcUrl, assetManager) {
|
|
9734
|
+
const provider = await getProvider(base58PublicKey, rpcUrl);
|
|
9747
9735
|
const idl = await getAssetManagerIdl(assetManager, provider);
|
|
9748
9736
|
return new anchor.Program(idl, provider);
|
|
9749
9737
|
}
|
|
9750
|
-
async function getConnectionProgram(base58PublicKey, rpcUrl,
|
|
9751
|
-
const provider = await getProvider(base58PublicKey, rpcUrl
|
|
9738
|
+
async function getConnectionProgram(base58PublicKey, rpcUrl, connection) {
|
|
9739
|
+
const provider = await getProvider(base58PublicKey, rpcUrl);
|
|
9752
9740
|
const idl = await getConnectionIdl(connection, provider);
|
|
9753
9741
|
return new anchor.Program(idl, provider);
|
|
9754
9742
|
}
|
|
@@ -9830,7 +9818,6 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9830
9818
|
const assetManagerProgram = await getAssetManagerProgram(
|
|
9831
9819
|
spokeProvider.walletProvider.getWalletBase58PublicKey(),
|
|
9832
9820
|
spokeProvider.chainConfig.rpcUrl,
|
|
9833
|
-
spokeProvider.chainConfig.wsUrl,
|
|
9834
9821
|
spokeProvider.chainConfig.addresses.assetManager
|
|
9835
9822
|
);
|
|
9836
9823
|
const solToken = new PublicKey(Buffer.from(token, "hex"));
|
|
@@ -9860,18 +9847,16 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9860
9847
|
let depositInstruction;
|
|
9861
9848
|
const amountBN = new BN(amount);
|
|
9862
9849
|
const { walletProvider, chainConfig } = spokeProvider;
|
|
9863
|
-
const { rpcUrl,
|
|
9850
|
+
const { rpcUrl, addresses } = chainConfig;
|
|
9864
9851
|
const walletPublicKey = new PublicKey(walletProvider.getWalletBase58PublicKey());
|
|
9865
9852
|
const assetManagerProgram = await getAssetManagerProgram(
|
|
9866
9853
|
walletProvider.getWalletBase58PublicKey(),
|
|
9867
9854
|
rpcUrl,
|
|
9868
|
-
wsUrl,
|
|
9869
9855
|
addresses.assetManager
|
|
9870
9856
|
);
|
|
9871
9857
|
const connectionProgram = await getConnectionProgram(
|
|
9872
9858
|
walletProvider.getWalletBase58PublicKey(),
|
|
9873
9859
|
rpcUrl,
|
|
9874
|
-
wsUrl,
|
|
9875
9860
|
addresses.connection
|
|
9876
9861
|
);
|
|
9877
9862
|
if (isNative(token)) {
|
|
@@ -9946,12 +9931,11 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9946
9931
|
*/
|
|
9947
9932
|
static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
|
|
9948
9933
|
const { walletProvider, chainConfig } = spokeProvider;
|
|
9949
|
-
const { rpcUrl,
|
|
9934
|
+
const { rpcUrl, addresses } = chainConfig;
|
|
9950
9935
|
const walletPublicKey = new PublicKey(walletProvider.getWalletBase58PublicKey());
|
|
9951
9936
|
const connectionProgram = await getConnectionProgram(
|
|
9952
9937
|
walletProvider.getWalletBase58PublicKey(),
|
|
9953
9938
|
rpcUrl,
|
|
9954
|
-
wsUrl,
|
|
9955
9939
|
addresses.connection
|
|
9956
9940
|
);
|
|
9957
9941
|
const sendMessageInstruction = await connectionProgram.methods.sendMessage(
|