@swapkit/toolboxes 4.3.6 → 4.3.8
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/src/evm/index.cjs +2 -2
- package/dist/src/evm/index.cjs.map +7 -7
- package/dist/src/evm/index.js +2 -2
- package/dist/src/evm/index.js.map +7 -7
- package/dist/src/index.cjs +3 -3
- package/dist/src/index.cjs.map +13 -13
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +13 -13
- package/dist/src/near/index.cjs +2 -2
- package/dist/src/near/index.cjs.map +3 -3
- package/dist/src/near/index.js +2 -2
- package/dist/src/near/index.js.map +3 -3
- package/dist/src/radix/index.cjs +2 -2
- package/dist/src/radix/index.cjs.map +3 -3
- package/dist/src/radix/index.js +2 -2
- package/dist/src/radix/index.js.map +3 -3
- package/dist/src/solana/index.cjs +2 -2
- package/dist/src/solana/index.cjs.map +3 -3
- package/dist/src/solana/index.js +2 -2
- package/dist/src/solana/index.js.map +3 -3
- package/dist/src/substrate/index.cjs +2 -2
- package/dist/src/substrate/index.cjs.map +3 -3
- package/dist/src/substrate/index.js +2 -2
- package/dist/src/substrate/index.js.map +3 -3
- package/dist/src/sui/index.cjs +2 -2
- package/dist/src/sui/index.cjs.map +3 -3
- package/dist/src/sui/index.js +2 -2
- package/dist/src/sui/index.js.map +3 -3
- package/dist/src/ton/index.cjs +2 -2
- package/dist/src/ton/index.cjs.map +3 -3
- package/dist/src/ton/index.js +2 -2
- package/dist/src/ton/index.js.map +3 -3
- package/dist/src/utxo/index.cjs +3 -3
- package/dist/src/utxo/index.cjs.map +4 -4
- package/dist/src/utxo/index.js +3 -3
- package/dist/src/utxo/index.js.map +4 -4
- package/dist/types/evm/helpers.d.ts +1 -1
- package/dist/types/evm/helpers.d.ts.map +1 -1
- package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +2 -0
- package/dist/types/evm/toolbox/baseEVMToolbox.d.ts.map +1 -1
- package/dist/types/evm/toolbox/evm.d.ts +38 -38
- package/dist/types/evm/toolbox/evm.d.ts.map +1 -1
- package/dist/types/evm/toolbox/op.d.ts +2 -14
- package/dist/types/evm/toolbox/op.d.ts.map +1 -1
- package/dist/types/radix/index.d.ts.map +1 -1
- package/dist/types/solana/toolbox.d.ts.map +1 -1
- package/dist/types/sui/toolbox.d.ts.map +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utxo/toolbox/zcash.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/evm/helpers.ts +7 -9
- package/src/evm/toolbox/baseEVMToolbox.ts +4 -1
- package/src/evm/toolbox/evm.ts +2 -3
- package/src/evm/toolbox/op.ts +1 -21
- package/src/radix/index.ts +7 -1
- package/src/solana/toolbox.ts +2 -8
- package/src/substrate/balance.ts +2 -2
- package/src/sui/toolbox.ts +4 -3
- package/src/ton/toolbox.ts +2 -2
- package/src/utils.ts +8 -1
- package/src/utxo/toolbox/zcash.ts +1 -4
package/src/substrate/balance.ts
CHANGED
|
@@ -29,7 +29,7 @@ export async function getSubstrateBalance(
|
|
|
29
29
|
} catch (error) {
|
|
30
30
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
31
31
|
console.error(`Error fetching substrate balance: ${errorMessage}`);
|
|
32
|
-
return [];
|
|
32
|
+
return [gasAsset.set(0)];
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -66,7 +66,7 @@ export async function getChainflipBalance(
|
|
|
66
66
|
} catch (error) {
|
|
67
67
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
68
68
|
console.error(`Error fetching chainflip balance: ${errorMessage}`);
|
|
69
|
-
return [];
|
|
69
|
+
return [gasAsset.set(0)];
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
package/src/sui/toolbox.ts
CHANGED
|
@@ -40,10 +40,11 @@ export async function getSuiToolbox({ provider: providerParam, ...signerParams }
|
|
|
40
40
|
throw new SwapKitError("toolbox_sui_address_required" as any);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
const { baseDecimal: fromBaseDecimal, chain } = getChainConfig(Chain.Sui);
|
|
44
|
+
|
|
43
45
|
try {
|
|
44
46
|
const suiClient = await getSuiClient();
|
|
45
47
|
const { totalBalance } = await suiClient.getBalance({ owner: addressToQuery });
|
|
46
|
-
const { baseDecimal: fromBaseDecimal, chain } = getChainConfig(Chain.Sui);
|
|
47
48
|
|
|
48
49
|
const suiBalances = [AssetValue.from({ chain, fromBaseDecimal, value: totalBalance })];
|
|
49
50
|
|
|
@@ -60,8 +61,8 @@ export async function getSuiToolbox({ provider: providerParam, ...signerParams }
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
return suiBalances;
|
|
63
|
-
} catch
|
|
64
|
-
|
|
64
|
+
} catch {
|
|
65
|
+
return [AssetValue.from({ chain })];
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
package/src/ton/toolbox.ts
CHANGED
|
@@ -52,8 +52,8 @@ export async function getTONToolbox(toolboxParams: TONToolboxParams = {}) {
|
|
|
52
52
|
try {
|
|
53
53
|
const balance = await client.getBalance(Address.parse(address));
|
|
54
54
|
return [AssetValue.from({ chain: Chain.Ton, value: SwapKitNumber.fromBigInt(balance, baseDecimal) })];
|
|
55
|
-
} catch
|
|
56
|
-
|
|
55
|
+
} catch {
|
|
56
|
+
return [AssetValue.from({ chain: Chain.Ton })];
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
package/src/utils.ts
CHANGED
|
@@ -20,8 +20,15 @@ export function getBalance<T extends Chain>(chain: T) {
|
|
|
20
20
|
return async function getBalance(address: string, scamFilter = true) {
|
|
21
21
|
const balances = await SwapKitApi.getChainBalance({ address, chain, scamFilter });
|
|
22
22
|
const { baseDecimal } = getChainConfig(chain);
|
|
23
|
-
|
|
23
|
+
const assetValues = balances.map(({ identifier, value, decimal }) => {
|
|
24
24
|
return new AssetValue({ decimal: decimal || baseDecimal, identifier, value });
|
|
25
25
|
});
|
|
26
|
+
|
|
27
|
+
const hasNativeAsset = assetValues.some((asset) => asset.isGasAsset);
|
|
28
|
+
if (!hasNativeAsset) {
|
|
29
|
+
return [AssetValue.from({ chain }), ...assetValues];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return assetValues;
|
|
26
33
|
};
|
|
27
34
|
}
|
|
@@ -145,10 +145,7 @@ async function createTransaction(buildTxParams: UTXOBuildTxParams) {
|
|
|
145
145
|
|
|
146
146
|
const psbt = bitgo.createPsbtForNetwork({ network: getZcashNetwork() }, { version: 455 }) as ZcashPsbt;
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
const NU5 = 0xc2d6d0b4;
|
|
150
|
-
// const branchId = tipHeight >= 2726400 ? NU6 : tipHeight >= 1687104 ? NU5 : NU5;
|
|
151
|
-
const branchId = NU5;
|
|
148
|
+
const branchId = 0x4dec4df0;
|
|
152
149
|
|
|
153
150
|
const CONSENSUS_BRANCH_ID_KEY = Buffer.concat([Buffer.of(0xfc), Buffer.of(0x05), Buffer.from("BITGO"), Buffer.of(0)]);
|
|
154
151
|
|