@cryptorubic/web3 1.1.0-alpha-stellar.0 → 1.1.0-alpha-stellar.1
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/package.json
CHANGED
|
@@ -21,7 +21,7 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
async getTokensBalances(userAddress, tokensAddresses) {
|
|
24
|
-
const sacTokenAddresses = tokensAddresses.map((address) => address.startsWith('C') ? address : this.convertClassicTokenAddressToSAC(
|
|
24
|
+
const sacTokenAddresses = tokensAddresses.map((address) => address.startsWith('C') ? address : this.convertClassicTokenAddressToSAC(address));
|
|
25
25
|
const balancePromises = sacTokenAddresses.map(async (contractId) => {
|
|
26
26
|
const contract = new stellar_sdk_1.Contract(contractId);
|
|
27
27
|
const operation = contract.call('balance', (0, stellar_sdk_1.nativeToScVal)(userAddress, { type: 'address' }));
|
|
@@ -51,8 +51,9 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
51
51
|
multicallContractsMethods(contractAbi, contractsData) {
|
|
52
52
|
throw new Error('Not Implemented ');
|
|
53
53
|
}
|
|
54
|
-
convertClassicTokenAddressToSAC(
|
|
55
|
-
const
|
|
54
|
+
convertClassicTokenAddressToSAC(tokenAddress) {
|
|
55
|
+
const [code, address] = tokenAddress === '0x0000000000000000000000000000000000000000' ? [stellar_sdk_1.Asset.native().code, undefined] : tokenAddress.split('-');
|
|
56
|
+
const classicAsset = new stellar_sdk_1.Asset(code, address);
|
|
56
57
|
return classicAsset.contractId(stellar_sdk_1.Networks.PUBLIC);
|
|
57
58
|
}
|
|
58
59
|
async read(address, abi, method, methodArgs = []) {
|