@joai/warps-adapter-evm 1.2.0 → 1.2.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/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -197,6 +197,8 @@ declare class WarpEvmDataLoader implements AdapterWarpDataLoader {
|
|
|
197
197
|
private uniswapService;
|
|
198
198
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
199
199
|
private getRequiredConfirmations;
|
|
200
|
+
private static readonly ChainsWithoutNativeBalance;
|
|
201
|
+
private hasNativeBalance;
|
|
200
202
|
getAccount(address: string): Promise<WarpChainAccount>;
|
|
201
203
|
getAccountAssets(address: string): Promise<WarpChainAsset[]>;
|
|
202
204
|
getAsset(identifier: string): Promise<WarpChainAsset | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -197,6 +197,8 @@ declare class WarpEvmDataLoader implements AdapterWarpDataLoader {
|
|
|
197
197
|
private uniswapService;
|
|
198
198
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
199
199
|
private getRequiredConfirmations;
|
|
200
|
+
private static readonly ChainsWithoutNativeBalance;
|
|
201
|
+
private hasNativeBalance;
|
|
200
202
|
getAccount(address: string): Promise<WarpChainAccount>;
|
|
201
203
|
getAccountAssets(address: string): Promise<WarpChainAsset[]>;
|
|
202
204
|
getAsset(identifier: string): Promise<WarpChainAsset | null>;
|
package/dist/index.js
CHANGED
|
@@ -908,7 +908,7 @@ var ERC20_ABI = [
|
|
|
908
908
|
"function symbol() view returns (string)",
|
|
909
909
|
"function totalSupply() view returns (uint256)"
|
|
910
910
|
];
|
|
911
|
-
var
|
|
911
|
+
var _WarpEvmDataLoader = class _WarpEvmDataLoader {
|
|
912
912
|
constructor(config, chain) {
|
|
913
913
|
this.config = config;
|
|
914
914
|
this.chain = chain;
|
|
@@ -924,8 +924,11 @@ var WarpEvmDataLoader = class {
|
|
|
924
924
|
}
|
|
925
925
|
return 1;
|
|
926
926
|
}
|
|
927
|
+
hasNativeBalance() {
|
|
928
|
+
return !_WarpEvmDataLoader.ChainsWithoutNativeBalance.includes(this.chain.name);
|
|
929
|
+
}
|
|
927
930
|
async getAccount(address) {
|
|
928
|
-
const balance = await this.provider.getBalance(address);
|
|
931
|
+
const balance = this.hasNativeBalance() ? await this.provider.getBalance(address) : 0n;
|
|
929
932
|
return {
|
|
930
933
|
chain: this.chain.name,
|
|
931
934
|
address,
|
|
@@ -935,7 +938,7 @@ var WarpEvmDataLoader = class {
|
|
|
935
938
|
async getAccountAssets(address) {
|
|
936
939
|
const account = await this.getAccount(address);
|
|
937
940
|
const tokenBalances = await this.getERC20TokenBalances(address);
|
|
938
|
-
let assets = account.balance > 0 ? [{ ...this.chain.nativeToken, amount: account.balance }] : [];
|
|
941
|
+
let assets = this.hasNativeBalance() && account.balance > 0 ? [{ ...this.chain.nativeToken, amount: account.balance }] : [];
|
|
939
942
|
for (const tokenBalance of tokenBalances) {
|
|
940
943
|
if (tokenBalance.balance > 0n) {
|
|
941
944
|
assets.push({
|
|
@@ -1082,6 +1085,8 @@ var WarpEvmDataLoader = class {
|
|
|
1082
1085
|
};
|
|
1083
1086
|
}
|
|
1084
1087
|
};
|
|
1088
|
+
_WarpEvmDataLoader.ChainsWithoutNativeBalance = [import_warps16.WarpChainName.Tempo];
|
|
1089
|
+
var WarpEvmDataLoader = _WarpEvmDataLoader;
|
|
1085
1090
|
|
|
1086
1091
|
// src/WarpEvmExecutor.ts
|
|
1087
1092
|
var import_warps19 = require("@joai/warps");
|