@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/README.md
CHANGED
|
@@ -225,8 +225,8 @@ As part of Sodax suite, xWagmi SDK is also going to be provided as one example w
|
|
|
225
225
|
- `ISuiWalletProvider`: Sui ✅
|
|
226
226
|
- `IIconWalletProvider`: ICON ✅
|
|
227
227
|
- `IStellarWalletProvider`: Stellar ✅
|
|
228
|
-
- Solana
|
|
229
|
-
- Injective
|
|
228
|
+
- Solana ✅
|
|
229
|
+
- Injective ✅
|
|
230
230
|
- Havah ❌ Coming soon
|
|
231
231
|
|
|
232
232
|
### Initialising Spoke Provider
|
package/dist/index.cjs
CHANGED
|
@@ -5286,8 +5286,7 @@ var spokeChainConfig = {
|
|
|
5286
5286
|
}
|
|
5287
5287
|
},
|
|
5288
5288
|
gasPrice: "500000",
|
|
5289
|
-
rpcUrl: "https://
|
|
5290
|
-
wsUrl: "https://solana-mainnet.g.alchemy.com/v2/i3q5fE3cYSFBE4Lcg1kS5",
|
|
5289
|
+
rpcUrl: "https://api.mainnet-beta.solana.com",
|
|
5291
5290
|
walletAddress: ""
|
|
5292
5291
|
},
|
|
5293
5292
|
[types.AVALANCHE_MAINNET_CHAIN_ID]: {
|
|
@@ -6846,16 +6845,7 @@ var InjectiveSpokeProvider = class {
|
|
|
6846
6845
|
return this.transfer(sender, token, to, amount, data, funds, raw);
|
|
6847
6846
|
}
|
|
6848
6847
|
async isNative(token) {
|
|
6849
|
-
|
|
6850
|
-
const injective20Token = new Injective20Token(this.walletProvider, token);
|
|
6851
|
-
try {
|
|
6852
|
-
await injective20Token.getTokenInfo();
|
|
6853
|
-
isNative2 = false;
|
|
6854
|
-
} catch (err) {
|
|
6855
|
-
console.error("[InjectiveSpokeProvider] isNative error", err);
|
|
6856
|
-
throw err;
|
|
6857
|
-
}
|
|
6858
|
-
return isNative2;
|
|
6848
|
+
return token === "inj";
|
|
6859
6849
|
}
|
|
6860
6850
|
async receiveMessage(senderAddress, srcChainId, srcAddress, connSn, payload, signatures) {
|
|
6861
6851
|
const msg = {
|
|
@@ -9734,15 +9724,13 @@ var IconSpokeService = class _IconSpokeService {
|
|
|
9734
9724
|
});
|
|
9735
9725
|
}
|
|
9736
9726
|
};
|
|
9737
|
-
async function getProvider(base58PublicKey, rpcUrl
|
|
9727
|
+
async function getProvider(base58PublicKey, rpcUrl) {
|
|
9738
9728
|
const wallet = {
|
|
9739
9729
|
publicKey: new web3_js.PublicKey(base58PublicKey),
|
|
9740
9730
|
signTransaction: () => Promise.reject(),
|
|
9741
9731
|
signAllTransactions: () => Promise.reject()
|
|
9742
9732
|
};
|
|
9743
|
-
const connection = new web3_js.Connection(rpcUrl
|
|
9744
|
-
wsEndpoint: wsUrl
|
|
9745
|
-
});
|
|
9733
|
+
const connection = new web3_js.Connection(rpcUrl);
|
|
9746
9734
|
return new anchor__namespace.AnchorProvider(connection, wallet, { commitment: "confirmed" });
|
|
9747
9735
|
}
|
|
9748
9736
|
async function getAssetManagerIdl(assetManager, provider) {
|
|
@@ -9769,13 +9757,13 @@ async function getConnectionIdl(connection, provider) {
|
|
|
9769
9757
|
throw err;
|
|
9770
9758
|
}
|
|
9771
9759
|
}
|
|
9772
|
-
async function getAssetManagerProgram(base58PublicKey, rpcUrl,
|
|
9773
|
-
const provider = await getProvider(base58PublicKey, rpcUrl
|
|
9760
|
+
async function getAssetManagerProgram(base58PublicKey, rpcUrl, assetManager) {
|
|
9761
|
+
const provider = await getProvider(base58PublicKey, rpcUrl);
|
|
9774
9762
|
const idl = await getAssetManagerIdl(assetManager, provider);
|
|
9775
9763
|
return new anchor__namespace.Program(idl, provider);
|
|
9776
9764
|
}
|
|
9777
|
-
async function getConnectionProgram(base58PublicKey, rpcUrl,
|
|
9778
|
-
const provider = await getProvider(base58PublicKey, rpcUrl
|
|
9765
|
+
async function getConnectionProgram(base58PublicKey, rpcUrl, connection) {
|
|
9766
|
+
const provider = await getProvider(base58PublicKey, rpcUrl);
|
|
9779
9767
|
const idl = await getConnectionIdl(connection, provider);
|
|
9780
9768
|
return new anchor__namespace.Program(idl, provider);
|
|
9781
9769
|
}
|
|
@@ -9857,7 +9845,6 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9857
9845
|
const assetManagerProgram = await getAssetManagerProgram(
|
|
9858
9846
|
spokeProvider.walletProvider.getWalletBase58PublicKey(),
|
|
9859
9847
|
spokeProvider.chainConfig.rpcUrl,
|
|
9860
|
-
spokeProvider.chainConfig.wsUrl,
|
|
9861
9848
|
spokeProvider.chainConfig.addresses.assetManager
|
|
9862
9849
|
);
|
|
9863
9850
|
const solToken = new web3_js.PublicKey(Buffer.from(token, "hex"));
|
|
@@ -9887,18 +9874,16 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9887
9874
|
let depositInstruction;
|
|
9888
9875
|
const amountBN = new BN__default.default(amount);
|
|
9889
9876
|
const { walletProvider, chainConfig } = spokeProvider;
|
|
9890
|
-
const { rpcUrl,
|
|
9877
|
+
const { rpcUrl, addresses } = chainConfig;
|
|
9891
9878
|
const walletPublicKey = new web3_js.PublicKey(walletProvider.getWalletBase58PublicKey());
|
|
9892
9879
|
const assetManagerProgram = await getAssetManagerProgram(
|
|
9893
9880
|
walletProvider.getWalletBase58PublicKey(),
|
|
9894
9881
|
rpcUrl,
|
|
9895
|
-
wsUrl,
|
|
9896
9882
|
addresses.assetManager
|
|
9897
9883
|
);
|
|
9898
9884
|
const connectionProgram = await getConnectionProgram(
|
|
9899
9885
|
walletProvider.getWalletBase58PublicKey(),
|
|
9900
9886
|
rpcUrl,
|
|
9901
|
-
wsUrl,
|
|
9902
9887
|
addresses.connection
|
|
9903
9888
|
);
|
|
9904
9889
|
if (isNative(token)) {
|
|
@@ -9973,12 +9958,11 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
9973
9958
|
*/
|
|
9974
9959
|
static async call(dstChainId, dstAddress, payload, spokeProvider, raw) {
|
|
9975
9960
|
const { walletProvider, chainConfig } = spokeProvider;
|
|
9976
|
-
const { rpcUrl,
|
|
9961
|
+
const { rpcUrl, addresses } = chainConfig;
|
|
9977
9962
|
const walletPublicKey = new web3_js.PublicKey(walletProvider.getWalletBase58PublicKey());
|
|
9978
9963
|
const connectionProgram = await getConnectionProgram(
|
|
9979
9964
|
walletProvider.getWalletBase58PublicKey(),
|
|
9980
9965
|
rpcUrl,
|
|
9981
|
-
wsUrl,
|
|
9982
9966
|
addresses.connection
|
|
9983
9967
|
);
|
|
9984
9968
|
const sendMessageInstruction = await connectionProgram.methods.sendMessage(
|