@joai/warps-adapter-evm 1.0.1 → 1.2.0
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 +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +334 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +289 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/chains/arbitrum.ts
|
|
2
|
-
import { WarpChainName as
|
|
2
|
+
import { WarpChainName as WarpChainName12 } from "@joai/warps";
|
|
3
3
|
|
|
4
4
|
// src/WarpEvmDataLoader.ts
|
|
5
5
|
import {
|
|
@@ -33,7 +33,7 @@ var _UniswapService = class _UniswapService {
|
|
|
33
33
|
async findToken(address) {
|
|
34
34
|
const normalizedAddress = address.toLowerCase();
|
|
35
35
|
const cacheKey = `uniswap:token:${this.chainId}:${normalizedAddress}`;
|
|
36
|
-
const cachedToken = this.cache.get(cacheKey);
|
|
36
|
+
const cachedToken = await this.cache.get(cacheKey);
|
|
37
37
|
if (cachedToken) {
|
|
38
38
|
return cachedToken;
|
|
39
39
|
}
|
|
@@ -44,9 +44,9 @@ var _UniswapService = class _UniswapService {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
if (token) {
|
|
47
|
-
this.cache.set(cacheKey, token, CacheTtl.OneHour);
|
|
47
|
+
await this.cache.set(cacheKey, token, CacheTtl.OneHour);
|
|
48
48
|
} else {
|
|
49
|
-
this.cache.set(cacheKey, null, CacheTtl.OneMinute * 5);
|
|
49
|
+
await this.cache.set(cacheKey, null, CacheTtl.OneMinute * 5);
|
|
50
50
|
}
|
|
51
51
|
return token;
|
|
52
52
|
} catch (error) {
|
|
@@ -56,13 +56,13 @@ var _UniswapService = class _UniswapService {
|
|
|
56
56
|
async getTokenMetadata(address) {
|
|
57
57
|
const normalizedAddress = address.toLowerCase();
|
|
58
58
|
const cacheKey = `uniswap:metadata:${this.chainId}:${normalizedAddress}`;
|
|
59
|
-
const cachedMetadata = this.cache.get(cacheKey);
|
|
59
|
+
const cachedMetadata = await this.cache.get(cacheKey);
|
|
60
60
|
if (cachedMetadata !== null) {
|
|
61
61
|
return cachedMetadata;
|
|
62
62
|
}
|
|
63
63
|
const token = await this.findToken(address);
|
|
64
64
|
if (!token) {
|
|
65
|
-
this.cache.set(cacheKey, null, CacheTtl.OneMinute * 5);
|
|
65
|
+
await this.cache.set(cacheKey, null, CacheTtl.OneMinute * 5);
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
const metadata = {
|
|
@@ -71,26 +71,26 @@ var _UniswapService = class _UniswapService {
|
|
|
71
71
|
decimals: token.decimals,
|
|
72
72
|
logoUrl: token.logoURI
|
|
73
73
|
};
|
|
74
|
-
this.cache.set(cacheKey, metadata, CacheTtl.OneHour);
|
|
74
|
+
await this.cache.set(cacheKey, metadata, CacheTtl.OneHour);
|
|
75
75
|
return metadata;
|
|
76
76
|
}
|
|
77
77
|
async getBridgeInfo(address) {
|
|
78
78
|
const normalizedAddress = address.toLowerCase();
|
|
79
79
|
const cacheKey = `uniswap:bridge:${this.chainId}:${normalizedAddress}`;
|
|
80
|
-
const cachedBridgeInfo = this.cache.get(cacheKey);
|
|
80
|
+
const cachedBridgeInfo = await this.cache.get(cacheKey);
|
|
81
81
|
if (cachedBridgeInfo !== null) {
|
|
82
82
|
return cachedBridgeInfo;
|
|
83
83
|
}
|
|
84
84
|
const token = await this.findToken(address);
|
|
85
85
|
if (!token?.extensions?.bridgeInfo) {
|
|
86
|
-
this.cache.set(cacheKey, null, CacheTtl.OneMinute * 5);
|
|
86
|
+
await this.cache.set(cacheKey, null, CacheTtl.OneMinute * 5);
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
89
|
const bridgeInfo = {};
|
|
90
90
|
for (const [chainId, info] of Object.entries(token.extensions.bridgeInfo)) {
|
|
91
91
|
bridgeInfo[chainId] = info.tokenAddress;
|
|
92
92
|
}
|
|
93
|
-
this.cache.set(cacheKey, bridgeInfo, CacheTtl.OneHour);
|
|
93
|
+
await this.cache.set(cacheKey, bridgeInfo, CacheTtl.OneHour);
|
|
94
94
|
return bridgeInfo;
|
|
95
95
|
}
|
|
96
96
|
};
|
|
@@ -102,6 +102,7 @@ import { ethers } from "ethers";
|
|
|
102
102
|
import {
|
|
103
103
|
getWarpWalletMnemonicFromConfig,
|
|
104
104
|
getWarpWalletPrivateKeyFromConfig,
|
|
105
|
+
removeWarpWalletFromConfig,
|
|
105
106
|
setWarpWalletInConfig
|
|
106
107
|
} from "@joai/warps";
|
|
107
108
|
var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
|
|
@@ -190,6 +191,9 @@ var _PrivateKeyWalletProvider = class _PrivateKeyWalletProvider {
|
|
|
190
191
|
mnemonic: null
|
|
191
192
|
};
|
|
192
193
|
}
|
|
194
|
+
async delete(externalId) {
|
|
195
|
+
removeWarpWalletFromConfig(this.config, this.chain.name);
|
|
196
|
+
}
|
|
193
197
|
getWallet() {
|
|
194
198
|
if (this.wallet) return this.wallet;
|
|
195
199
|
const privateKey = getWarpWalletPrivateKeyFromConfig(this.config, this.chain.name);
|
|
@@ -210,6 +214,7 @@ import {
|
|
|
210
214
|
getWarpWalletPrivateKeyFromConfig as getWarpWalletPrivateKeyFromConfig2,
|
|
211
215
|
normalizeAndValidateMnemonic,
|
|
212
216
|
normalizeMnemonic,
|
|
217
|
+
removeWarpWalletFromConfig as removeWarpWalletFromConfig2,
|
|
213
218
|
setWarpWalletInConfig as setWarpWalletInConfig2,
|
|
214
219
|
validateMnemonicLength
|
|
215
220
|
} from "@joai/warps";
|
|
@@ -304,6 +309,9 @@ var _MnemonicWalletProvider = class _MnemonicWalletProvider {
|
|
|
304
309
|
mnemonic
|
|
305
310
|
};
|
|
306
311
|
}
|
|
312
|
+
async delete(externalId) {
|
|
313
|
+
removeWarpWalletFromConfig2(this.config, this.chain.name);
|
|
314
|
+
}
|
|
307
315
|
getWallet() {
|
|
308
316
|
if (this.wallet) return this.wallet;
|
|
309
317
|
const mnemonic = getWarpWalletMnemonicFromConfig2(this.config, this.chain.name);
|
|
@@ -316,7 +324,7 @@ _MnemonicWalletProvider.PROVIDER_NAME = "mnemonic";
|
|
|
316
324
|
var MnemonicWalletProvider = _MnemonicWalletProvider;
|
|
317
325
|
|
|
318
326
|
// src/providers/ReadOnlyWalletProvider.ts
|
|
319
|
-
import { getWarpWalletAddressFromConfig } from "@joai/warps";
|
|
327
|
+
import { getWarpWalletAddressFromConfig, removeWarpWalletFromConfig as removeWarpWalletFromConfig3 } from "@joai/warps";
|
|
320
328
|
var ReadOnlyWalletProvider = class {
|
|
321
329
|
constructor(config, chain) {
|
|
322
330
|
this.config = config;
|
|
@@ -352,10 +360,13 @@ var ReadOnlyWalletProvider = class {
|
|
|
352
360
|
const address = getWarpWalletAddressFromConfig(this.config, this.chain.name);
|
|
353
361
|
throw new Error(`Wallet can not be used for signing: ${address}`);
|
|
354
362
|
}
|
|
363
|
+
async delete(externalId) {
|
|
364
|
+
removeWarpWalletFromConfig3(this.config, this.chain.name);
|
|
365
|
+
}
|
|
355
366
|
};
|
|
356
367
|
|
|
357
368
|
// src/tokens.ts
|
|
358
|
-
import { WarpChainName as
|
|
369
|
+
import { WarpChainName as WarpChainName11 } from "@joai/warps";
|
|
359
370
|
|
|
360
371
|
// src/tokens/arbitrum.ts
|
|
361
372
|
import { WarpChainName } from "@joai/warps";
|
|
@@ -685,27 +696,148 @@ var PolygonMumbaiTokens = [
|
|
|
685
696
|
}
|
|
686
697
|
];
|
|
687
698
|
|
|
699
|
+
// src/tokens/tempo.ts
|
|
700
|
+
import { WarpAssets, WarpChainName as WarpChainName9 } from "@joai/warps";
|
|
701
|
+
var TempoChain = WarpChainName9.Tempo;
|
|
702
|
+
var TempoTokens = [
|
|
703
|
+
{
|
|
704
|
+
chain: TempoChain,
|
|
705
|
+
identifier: "0x20c0000000000000000000000000000000000000",
|
|
706
|
+
name: "PathUSD",
|
|
707
|
+
symbol: "pathUSD",
|
|
708
|
+
decimals: 6,
|
|
709
|
+
logoUrl: WarpAssets.tokenLogo("pathusd.svg")
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
chain: TempoChain,
|
|
713
|
+
identifier: "0x20c000000000000000000000b9537d11c60e8b50",
|
|
714
|
+
name: "Bridged USDC (Stargate)",
|
|
715
|
+
symbol: "USDC.e",
|
|
716
|
+
decimals: 6,
|
|
717
|
+
logoUrl: WarpAssets.tokenLogo("usdc.svg")
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
chain: TempoChain,
|
|
721
|
+
identifier: "0x20c0000000000000000000001621e21f71cf12fb",
|
|
722
|
+
name: "Bridged EURC (Stargate)",
|
|
723
|
+
symbol: "EURC.e",
|
|
724
|
+
decimals: 6,
|
|
725
|
+
logoUrl: WarpAssets.tokenLogo("eurc.svg")
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
chain: TempoChain,
|
|
729
|
+
identifier: "0x20c00000000000000000000014f22ca97301eb73",
|
|
730
|
+
name: "USDT0",
|
|
731
|
+
symbol: "USDT0",
|
|
732
|
+
decimals: 6,
|
|
733
|
+
logoUrl: WarpAssets.tokenLogo("usdt.svg")
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
chain: TempoChain,
|
|
737
|
+
identifier: "0x20c0000000000000000000003554d28269e0f3c2",
|
|
738
|
+
name: "Frax USD",
|
|
739
|
+
symbol: "frxUSD",
|
|
740
|
+
decimals: 6,
|
|
741
|
+
logoUrl: WarpAssets.tokenLogo("frxusd.svg")
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
chain: TempoChain,
|
|
745
|
+
identifier: "0x20c0000000000000000000000520792dcccccccc",
|
|
746
|
+
name: "Cap USD",
|
|
747
|
+
symbol: "cUSD",
|
|
748
|
+
decimals: 6,
|
|
749
|
+
logoUrl: WarpAssets.tokenLogo("cusd.svg")
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
chain: TempoChain,
|
|
753
|
+
identifier: "0x20c00000000000000000000031f228af88888888",
|
|
754
|
+
name: "Staked Cap USD",
|
|
755
|
+
symbol: "stcUSD",
|
|
756
|
+
decimals: 6,
|
|
757
|
+
logoUrl: WarpAssets.tokenLogo("stcusd.svg")
|
|
758
|
+
}
|
|
759
|
+
];
|
|
760
|
+
|
|
761
|
+
// src/tokens/tempo-moderato.ts
|
|
762
|
+
import { WarpAssets as WarpAssets2, WarpChainName as WarpChainName10 } from "@joai/warps";
|
|
763
|
+
var TempoChain2 = WarpChainName10.Tempo;
|
|
764
|
+
var TempoModeratoTokens = [
|
|
765
|
+
{
|
|
766
|
+
chain: TempoChain2,
|
|
767
|
+
identifier: "0x20c0000000000000000000000000000000000000",
|
|
768
|
+
name: "PathUSD",
|
|
769
|
+
symbol: "pathUSD",
|
|
770
|
+
decimals: 6,
|
|
771
|
+
logoUrl: WarpAssets2.tokenLogo("pathusd.svg")
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
chain: TempoChain2,
|
|
775
|
+
identifier: "0x20c0000000000000000000000000000000000001",
|
|
776
|
+
name: "AlphaUSD",
|
|
777
|
+
symbol: "alphaUSD",
|
|
778
|
+
decimals: 6,
|
|
779
|
+
logoUrl: WarpAssets2.tokenLogo("pathusd.svg")
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
chain: TempoChain2,
|
|
783
|
+
identifier: "0x20c0000000000000000000000000000000000002",
|
|
784
|
+
name: "BetaUSD",
|
|
785
|
+
symbol: "betaUSD",
|
|
786
|
+
decimals: 6,
|
|
787
|
+
logoUrl: WarpAssets2.tokenLogo("pathusd.svg")
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
chain: TempoChain2,
|
|
791
|
+
identifier: "0x20c0000000000000000000000000000000000003",
|
|
792
|
+
name: "ThetaUSD",
|
|
793
|
+
symbol: "thetaUSD",
|
|
794
|
+
decimals: 6,
|
|
795
|
+
logoUrl: WarpAssets2.tokenLogo("pathusd.svg")
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
chain: TempoChain2,
|
|
799
|
+
identifier: "0x20c0000000000000000000009e8d7eb59b783726",
|
|
800
|
+
name: "Bridged USDC (Stargate)",
|
|
801
|
+
symbol: "USDC.e",
|
|
802
|
+
decimals: 6,
|
|
803
|
+
logoUrl: WarpAssets2.tokenLogo("usdc.svg")
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
chain: TempoChain2,
|
|
807
|
+
identifier: "0x20c000000000000000000000d72572838bbee59c",
|
|
808
|
+
name: "Bridged EURC (Stargate)",
|
|
809
|
+
symbol: "EURC.e",
|
|
810
|
+
decimals: 6,
|
|
811
|
+
logoUrl: WarpAssets2.tokenLogo("eurc.svg")
|
|
812
|
+
}
|
|
813
|
+
];
|
|
814
|
+
|
|
688
815
|
// src/tokens.ts
|
|
689
816
|
var KnownTokens = {
|
|
690
|
-
[
|
|
817
|
+
[WarpChainName11.Ethereum]: {
|
|
691
818
|
mainnet: EthereumTokens,
|
|
692
819
|
testnet: EthereumSepoliaTokens,
|
|
693
820
|
devnet: EthereumSepoliaTokens
|
|
694
821
|
},
|
|
695
|
-
[
|
|
822
|
+
[WarpChainName11.Base]: {
|
|
696
823
|
mainnet: BaseTokens,
|
|
697
824
|
testnet: BaseSepoliaTokens,
|
|
698
825
|
devnet: BaseSepoliaTokens
|
|
699
826
|
},
|
|
700
|
-
[
|
|
827
|
+
[WarpChainName11.Arbitrum]: {
|
|
701
828
|
mainnet: ArbitrumTokens,
|
|
702
829
|
testnet: ArbitrumSepoliaTokens,
|
|
703
830
|
devnet: ArbitrumSepoliaTokens
|
|
704
831
|
},
|
|
705
|
-
[
|
|
832
|
+
[WarpChainName11.Polygon]: {
|
|
706
833
|
mainnet: PolygonTokens,
|
|
707
834
|
testnet: PolygonMumbaiTokens,
|
|
708
835
|
devnet: PolygonMumbaiTokens
|
|
836
|
+
},
|
|
837
|
+
[WarpChainName11.Tempo]: {
|
|
838
|
+
mainnet: TempoTokens,
|
|
839
|
+
testnet: TempoModeratoTokens,
|
|
840
|
+
devnet: TempoModeratoTokens
|
|
709
841
|
}
|
|
710
842
|
};
|
|
711
843
|
var findKnownTokenById = (chain, env, id) => {
|
|
@@ -774,7 +906,7 @@ var WarpEvmDataLoader = class {
|
|
|
774
906
|
return this.chain.nativeToken;
|
|
775
907
|
}
|
|
776
908
|
const cacheKey = WarpCacheKey.Asset(this.config.env, this.chain.name, identifier);
|
|
777
|
-
const cachedAsset = this.cache.get(cacheKey);
|
|
909
|
+
const cachedAsset = await this.cache.get(cacheKey);
|
|
778
910
|
if (cachedAsset) {
|
|
779
911
|
return cachedAsset;
|
|
780
912
|
}
|
|
@@ -801,7 +933,7 @@ var WarpEvmDataLoader = class {
|
|
|
801
933
|
decimals: metadata.decimals,
|
|
802
934
|
logoUrl: metadata.logoUrl
|
|
803
935
|
};
|
|
804
|
-
this.cache.set(cacheKey, asset, CacheTtl2.OneHour);
|
|
936
|
+
await this.cache.set(cacheKey, asset, CacheTtl2.OneHour);
|
|
805
937
|
return asset;
|
|
806
938
|
} catch (error) {
|
|
807
939
|
return null;
|
|
@@ -959,6 +1091,12 @@ var PolygonExplorers = /* @__PURE__ */ ((PolygonExplorers2) => {
|
|
|
959
1091
|
PolygonExplorers2["BlockscoutPolygonMumbai"] = "blockscout_polygon_mumbai";
|
|
960
1092
|
return PolygonExplorers2;
|
|
961
1093
|
})(PolygonExplorers || {});
|
|
1094
|
+
var TempoExplorers = /* @__PURE__ */ ((TempoExplorers2) => {
|
|
1095
|
+
TempoExplorers2["TempoExplorer"] = "tempo_explorer";
|
|
1096
|
+
TempoExplorers2["TempoExplorerTestnet"] = "tempo_explorer_testnet";
|
|
1097
|
+
TempoExplorers2["TempoExplorerDevnet"] = "tempo_explorer_devnet";
|
|
1098
|
+
return TempoExplorers2;
|
|
1099
|
+
})(TempoExplorers || {});
|
|
962
1100
|
var EvmExplorers = {
|
|
963
1101
|
ethereum: {
|
|
964
1102
|
mainnet: ["etherscan" /* Etherscan */, "ethplorer" /* Ethplorer */, "blockscout" /* Blockscout */],
|
|
@@ -979,6 +1117,11 @@ var EvmExplorers = {
|
|
|
979
1117
|
mainnet: ["polygonscan" /* Polygonscan */, "blockscout_polygon" /* BlockscoutPolygon */],
|
|
980
1118
|
testnet: ["polygonscan_mumbai" /* PolygonscanMumbai */, "blockscout_polygon_mumbai" /* BlockscoutPolygonMumbai */],
|
|
981
1119
|
devnet: ["polygonscan_mumbai" /* PolygonscanMumbai */, "blockscout_polygon_mumbai" /* BlockscoutPolygonMumbai */]
|
|
1120
|
+
},
|
|
1121
|
+
tempo: {
|
|
1122
|
+
mainnet: ["tempo_explorer" /* TempoExplorer */],
|
|
1123
|
+
testnet: ["tempo_explorer_testnet" /* TempoExplorerTestnet */],
|
|
1124
|
+
devnet: ["tempo_explorer_devnet" /* TempoExplorerDevnet */]
|
|
982
1125
|
}
|
|
983
1126
|
};
|
|
984
1127
|
var ExplorerUrls = {
|
|
@@ -998,7 +1141,10 @@ var ExplorerUrls = {
|
|
|
998
1141
|
["polygonscan" /* Polygonscan */]: "https://polygonscan.com",
|
|
999
1142
|
["polygonscan_mumbai" /* PolygonscanMumbai */]: "https://mumbai.polygonscan.com",
|
|
1000
1143
|
["blockscout_polygon" /* BlockscoutPolygon */]: "https://polygon.blockscout.com",
|
|
1001
|
-
["blockscout_polygon_mumbai" /* BlockscoutPolygonMumbai */]: "https://mumbai.blockscout.com"
|
|
1144
|
+
["blockscout_polygon_mumbai" /* BlockscoutPolygonMumbai */]: "https://mumbai.blockscout.com",
|
|
1145
|
+
["tempo_explorer" /* TempoExplorer */]: "https://explore.tempo.xyz",
|
|
1146
|
+
["tempo_explorer_testnet" /* TempoExplorerTestnet */]: "https://explore.testnet.tempo.xyz",
|
|
1147
|
+
["tempo_explorer_devnet" /* TempoExplorerDevnet */]: "https://explore.devnet.tempo.xyz"
|
|
1002
1148
|
};
|
|
1003
1149
|
var EvmChainIds = {
|
|
1004
1150
|
Ethereum: {
|
|
@@ -1021,6 +1167,11 @@ var EvmChainIds = {
|
|
|
1021
1167
|
Optimism: {
|
|
1022
1168
|
Mainnet: 10,
|
|
1023
1169
|
Sepolia: 11155420
|
|
1170
|
+
},
|
|
1171
|
+
Tempo: {
|
|
1172
|
+
Mainnet: 4217,
|
|
1173
|
+
Moderato: 42431,
|
|
1174
|
+
Devnet: 31318
|
|
1024
1175
|
}
|
|
1025
1176
|
};
|
|
1026
1177
|
var EvmChainIdMap = {
|
|
@@ -1034,7 +1185,10 @@ var EvmChainIdMap = {
|
|
|
1034
1185
|
"base:mainnet": EvmChainIds.Base.Mainnet,
|
|
1035
1186
|
"base:sepolia": EvmChainIds.Base.Sepolia,
|
|
1036
1187
|
"optimism:mainnet": EvmChainIds.Optimism.Mainnet,
|
|
1037
|
-
"optimism:sepolia": EvmChainIds.Optimism.Sepolia
|
|
1188
|
+
"optimism:sepolia": EvmChainIds.Optimism.Sepolia,
|
|
1189
|
+
"tempo:mainnet": EvmChainIds.Tempo.Mainnet,
|
|
1190
|
+
"tempo:moderato": EvmChainIds.Tempo.Moderato,
|
|
1191
|
+
"tempo:devnet": EvmChainIds.Tempo.Devnet
|
|
1038
1192
|
};
|
|
1039
1193
|
var SupportedEvmChainIds = [
|
|
1040
1194
|
EvmChainIds.Ethereum.Mainnet,
|
|
@@ -1047,7 +1201,10 @@ var SupportedEvmChainIds = [
|
|
|
1047
1201
|
EvmChainIds.Base.Mainnet,
|
|
1048
1202
|
EvmChainIds.Base.Sepolia,
|
|
1049
1203
|
EvmChainIds.Optimism.Mainnet,
|
|
1050
|
-
EvmChainIds.Optimism.Sepolia
|
|
1204
|
+
EvmChainIds.Optimism.Sepolia,
|
|
1205
|
+
EvmChainIds.Tempo.Mainnet,
|
|
1206
|
+
EvmChainIds.Tempo.Moderato,
|
|
1207
|
+
EvmChainIds.Tempo.Devnet
|
|
1051
1208
|
];
|
|
1052
1209
|
|
|
1053
1210
|
// src/WarpEvmOutput.ts
|
|
@@ -1231,7 +1388,7 @@ var WarpEvmOutput = class {
|
|
|
1231
1388
|
this.cache = new WarpCache3(config.env, config.cache);
|
|
1232
1389
|
}
|
|
1233
1390
|
async getActionExecution(warp, actionIndex, tx) {
|
|
1234
|
-
const inputs = this.cache.get(WarpCacheKey2.WarpExecutable(this.config.env, warp.meta?.hash || "", actionIndex)) ?? [];
|
|
1391
|
+
const inputs = await this.cache.get(WarpCacheKey2.WarpExecutable(this.config.env, warp.meta?.hash || "", actionIndex)) ?? [];
|
|
1235
1392
|
const resolvedInputs = extractResolvedInputValues(inputs);
|
|
1236
1393
|
if (!tx) {
|
|
1237
1394
|
return this.createFailedExecution(warp, actionIndex, resolvedInputs);
|
|
@@ -1773,8 +1930,10 @@ var WarpEvmExplorer = class {
|
|
|
1773
1930
|
import {
|
|
1774
1931
|
getProviderConfig as getProviderConfig4
|
|
1775
1932
|
} from "@joai/warps";
|
|
1933
|
+
import { toClientEvmSigner } from "@x402/evm";
|
|
1776
1934
|
import { registerExactEvmScheme } from "@x402/evm/exact/client";
|
|
1777
1935
|
import { ethers as ethers7 } from "ethers";
|
|
1936
|
+
import { createPublicClient, http } from "viem";
|
|
1778
1937
|
import { privateKeyToAccount } from "viem/accounts";
|
|
1779
1938
|
var WarpEvmWallet = class {
|
|
1780
1939
|
constructor(config, chain) {
|
|
@@ -1871,6 +2030,10 @@ var WarpEvmWallet = class {
|
|
|
1871
2030
|
const walletProvider = this.createProviderForOperation(provider);
|
|
1872
2031
|
return await walletProvider.generate();
|
|
1873
2032
|
}
|
|
2033
|
+
async delete(provider, externalId) {
|
|
2034
|
+
const walletProvider = this.createProviderForOperation(provider);
|
|
2035
|
+
await walletProvider.delete(externalId);
|
|
2036
|
+
}
|
|
1874
2037
|
getAddress() {
|
|
1875
2038
|
return this.cachedAddress;
|
|
1876
2039
|
}
|
|
@@ -1884,7 +2047,12 @@ var WarpEvmWallet = class {
|
|
|
1884
2047
|
if (typeof getInstance !== "function") throw new Error("Wallet provider does not have getWalletInstance method");
|
|
1885
2048
|
const wallet = getInstance();
|
|
1886
2049
|
if (!wallet || !wallet.privateKey) throw new Error("Wallet instance does not have private key");
|
|
1887
|
-
const signer =
|
|
2050
|
+
const signer = toClientEvmSigner(
|
|
2051
|
+
privateKeyToAccount(wallet.privateKey),
|
|
2052
|
+
createPublicClient({
|
|
2053
|
+
transport: http(getProviderConfig4(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl).url)
|
|
2054
|
+
})
|
|
2055
|
+
);
|
|
1888
2056
|
const handlers = {};
|
|
1889
2057
|
for (const chainId of SupportedEvmChainIds) {
|
|
1890
2058
|
handlers[`eip155:${chainId}`] = () => {
|
|
@@ -1990,16 +2158,16 @@ var createEvmAdapter = (chainName, chainInfos) => {
|
|
|
1990
2158
|
|
|
1991
2159
|
// src/chains/arbitrum.ts
|
|
1992
2160
|
var NativeTokenArb = {
|
|
1993
|
-
chain:
|
|
2161
|
+
chain: WarpChainName12.Arbitrum,
|
|
1994
2162
|
identifier: "ARB",
|
|
1995
2163
|
symbol: "ARB",
|
|
1996
2164
|
name: "Arbitrum",
|
|
1997
2165
|
decimals: 18,
|
|
1998
2166
|
logoUrl: "https://raw.githubusercontent.com/JoAiHQ/assets/refs/heads/main/tokens/logos/arb.svg"
|
|
1999
2167
|
};
|
|
2000
|
-
var ArbitrumAdapter = createEvmAdapter(
|
|
2168
|
+
var ArbitrumAdapter = createEvmAdapter(WarpChainName12.Arbitrum, {
|
|
2001
2169
|
mainnet: {
|
|
2002
|
-
name:
|
|
2170
|
+
name: WarpChainName12.Arbitrum,
|
|
2003
2171
|
displayName: "Arbitrum",
|
|
2004
2172
|
chainId: "42161",
|
|
2005
2173
|
blockTime: 1e3,
|
|
@@ -2009,7 +2177,7 @@ var ArbitrumAdapter = createEvmAdapter(WarpChainName10.Arbitrum, {
|
|
|
2009
2177
|
nativeToken: NativeTokenArb
|
|
2010
2178
|
},
|
|
2011
2179
|
testnet: {
|
|
2012
|
-
name:
|
|
2180
|
+
name: WarpChainName12.Arbitrum,
|
|
2013
2181
|
displayName: "Arbitrum Sepolia",
|
|
2014
2182
|
chainId: "421614",
|
|
2015
2183
|
blockTime: 1e3,
|
|
@@ -2019,7 +2187,7 @@ var ArbitrumAdapter = createEvmAdapter(WarpChainName10.Arbitrum, {
|
|
|
2019
2187
|
nativeToken: NativeTokenArb
|
|
2020
2188
|
},
|
|
2021
2189
|
devnet: {
|
|
2022
|
-
name:
|
|
2190
|
+
name: WarpChainName12.Arbitrum,
|
|
2023
2191
|
displayName: "Arbitrum Sepolia",
|
|
2024
2192
|
chainId: "421614",
|
|
2025
2193
|
blockTime: 1e3,
|
|
@@ -2031,9 +2199,9 @@ var ArbitrumAdapter = createEvmAdapter(WarpChainName10.Arbitrum, {
|
|
|
2031
2199
|
});
|
|
2032
2200
|
|
|
2033
2201
|
// src/chains/base.ts
|
|
2034
|
-
import { WarpChainName as
|
|
2202
|
+
import { WarpChainName as WarpChainName13 } from "@joai/warps";
|
|
2035
2203
|
var NativeTokenBase = {
|
|
2036
|
-
chain:
|
|
2204
|
+
chain: WarpChainName13.Base,
|
|
2037
2205
|
identifier: "ETH",
|
|
2038
2206
|
name: "Ether",
|
|
2039
2207
|
symbol: "ETH",
|
|
@@ -2043,9 +2211,9 @@ var NativeTokenBase = {
|
|
|
2043
2211
|
dark: "https://raw.githubusercontent.com/JoAiHQ/assets/refs/heads/main/tokens/logos/eth-black.svg"
|
|
2044
2212
|
}
|
|
2045
2213
|
};
|
|
2046
|
-
var BaseAdapter = createEvmAdapter(
|
|
2214
|
+
var BaseAdapter = createEvmAdapter(WarpChainName13.Base, {
|
|
2047
2215
|
mainnet: {
|
|
2048
|
-
name:
|
|
2216
|
+
name: WarpChainName13.Base,
|
|
2049
2217
|
displayName: "Base",
|
|
2050
2218
|
chainId: "8453",
|
|
2051
2219
|
blockTime: 2e3,
|
|
@@ -2058,7 +2226,7 @@ var BaseAdapter = createEvmAdapter(WarpChainName11.Base, {
|
|
|
2058
2226
|
nativeToken: NativeTokenBase
|
|
2059
2227
|
},
|
|
2060
2228
|
testnet: {
|
|
2061
|
-
name:
|
|
2229
|
+
name: WarpChainName13.Base,
|
|
2062
2230
|
displayName: "Base Sepolia",
|
|
2063
2231
|
chainId: "84532",
|
|
2064
2232
|
blockTime: 2e3,
|
|
@@ -2071,7 +2239,7 @@ var BaseAdapter = createEvmAdapter(WarpChainName11.Base, {
|
|
|
2071
2239
|
nativeToken: NativeTokenBase
|
|
2072
2240
|
},
|
|
2073
2241
|
devnet: {
|
|
2074
|
-
name:
|
|
2242
|
+
name: WarpChainName13.Base,
|
|
2075
2243
|
displayName: "Base Sepolia",
|
|
2076
2244
|
chainId: "84532",
|
|
2077
2245
|
blockTime: 2e3,
|
|
@@ -2086,19 +2254,20 @@ var BaseAdapter = createEvmAdapter(WarpChainName11.Base, {
|
|
|
2086
2254
|
});
|
|
2087
2255
|
|
|
2088
2256
|
// src/chains/combined.ts
|
|
2089
|
-
import { WarpChainName as
|
|
2257
|
+
import { WarpChainName as WarpChainName14 } from "@joai/warps";
|
|
2090
2258
|
var getAllEvmChainNames = () => [
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2259
|
+
WarpChainName14.Ethereum,
|
|
2260
|
+
WarpChainName14.Base,
|
|
2261
|
+
WarpChainName14.Arbitrum,
|
|
2262
|
+
WarpChainName14.Polygon,
|
|
2263
|
+
WarpChainName14.Somnia,
|
|
2264
|
+
WarpChainName14.Tempo
|
|
2096
2265
|
];
|
|
2097
2266
|
|
|
2098
2267
|
// src/chains/ethereum.ts
|
|
2099
|
-
import { WarpChainName as
|
|
2268
|
+
import { WarpChainName as WarpChainName15 } from "@joai/warps";
|
|
2100
2269
|
var NativeTokenEth = {
|
|
2101
|
-
chain:
|
|
2270
|
+
chain: WarpChainName15.Ethereum,
|
|
2102
2271
|
identifier: "ETH",
|
|
2103
2272
|
symbol: "ETH",
|
|
2104
2273
|
name: "Ether",
|
|
@@ -2108,9 +2277,9 @@ var NativeTokenEth = {
|
|
|
2108
2277
|
dark: "https://raw.githubusercontent.com/JoAiHQ/assets/refs/heads/main/tokens/logos/eth-black.svg"
|
|
2109
2278
|
}
|
|
2110
2279
|
};
|
|
2111
|
-
var EthereumAdapter = createEvmAdapter(
|
|
2280
|
+
var EthereumAdapter = createEvmAdapter(WarpChainName15.Ethereum, {
|
|
2112
2281
|
mainnet: {
|
|
2113
|
-
name:
|
|
2282
|
+
name: WarpChainName15.Ethereum,
|
|
2114
2283
|
displayName: "Ethereum Mainnet",
|
|
2115
2284
|
chainId: "1",
|
|
2116
2285
|
blockTime: 12e3,
|
|
@@ -2123,7 +2292,7 @@ var EthereumAdapter = createEvmAdapter(WarpChainName13.Ethereum, {
|
|
|
2123
2292
|
nativeToken: NativeTokenEth
|
|
2124
2293
|
},
|
|
2125
2294
|
testnet: {
|
|
2126
|
-
name:
|
|
2295
|
+
name: WarpChainName15.Ethereum,
|
|
2127
2296
|
displayName: "Ethereum Sepolia",
|
|
2128
2297
|
chainId: "11155111",
|
|
2129
2298
|
blockTime: 12e3,
|
|
@@ -2136,7 +2305,7 @@ var EthereumAdapter = createEvmAdapter(WarpChainName13.Ethereum, {
|
|
|
2136
2305
|
nativeToken: NativeTokenEth
|
|
2137
2306
|
},
|
|
2138
2307
|
devnet: {
|
|
2139
|
-
name:
|
|
2308
|
+
name: WarpChainName15.Ethereum,
|
|
2140
2309
|
displayName: "Ethereum Sepolia",
|
|
2141
2310
|
chainId: "11155111",
|
|
2142
2311
|
blockTime: 12e3,
|
|
@@ -2151,9 +2320,9 @@ var EthereumAdapter = createEvmAdapter(WarpChainName13.Ethereum, {
|
|
|
2151
2320
|
});
|
|
2152
2321
|
|
|
2153
2322
|
// src/chains/polygon.ts
|
|
2154
|
-
import { WarpChainName as
|
|
2323
|
+
import { WarpChainName as WarpChainName16 } from "@joai/warps";
|
|
2155
2324
|
var NativeTokenPolygon = {
|
|
2156
|
-
chain:
|
|
2325
|
+
chain: WarpChainName16.Polygon,
|
|
2157
2326
|
identifier: "MATIC",
|
|
2158
2327
|
symbol: "MATIC",
|
|
2159
2328
|
name: "Polygon",
|
|
@@ -2163,9 +2332,9 @@ var NativeTokenPolygon = {
|
|
|
2163
2332
|
dark: "https://raw.githubusercontent.com/JoAiHQ/assets/refs/heads/main/tokens/logos/matic-black.svg"
|
|
2164
2333
|
}
|
|
2165
2334
|
};
|
|
2166
|
-
var PolygonAdapter = createEvmAdapter(
|
|
2335
|
+
var PolygonAdapter = createEvmAdapter(WarpChainName16.Polygon, {
|
|
2167
2336
|
mainnet: {
|
|
2168
|
-
name:
|
|
2337
|
+
name: WarpChainName16.Polygon,
|
|
2169
2338
|
displayName: "Polygon",
|
|
2170
2339
|
chainId: "137",
|
|
2171
2340
|
blockTime: 2e3,
|
|
@@ -2178,7 +2347,7 @@ var PolygonAdapter = createEvmAdapter(WarpChainName14.Polygon, {
|
|
|
2178
2347
|
nativeToken: NativeTokenPolygon
|
|
2179
2348
|
},
|
|
2180
2349
|
testnet: {
|
|
2181
|
-
name:
|
|
2350
|
+
name: WarpChainName16.Polygon,
|
|
2182
2351
|
displayName: "Polygon Mumbai",
|
|
2183
2352
|
chainId: "80001",
|
|
2184
2353
|
blockTime: 2e3,
|
|
@@ -2191,7 +2360,7 @@ var PolygonAdapter = createEvmAdapter(WarpChainName14.Polygon, {
|
|
|
2191
2360
|
nativeToken: NativeTokenPolygon
|
|
2192
2361
|
},
|
|
2193
2362
|
devnet: {
|
|
2194
|
-
name:
|
|
2363
|
+
name: WarpChainName16.Polygon,
|
|
2195
2364
|
displayName: "Polygon Mumbai",
|
|
2196
2365
|
chainId: "80001",
|
|
2197
2366
|
blockTime: 2e3,
|
|
@@ -2205,13 +2374,10 @@ var PolygonAdapter = createEvmAdapter(WarpChainName14.Polygon, {
|
|
|
2205
2374
|
}
|
|
2206
2375
|
});
|
|
2207
2376
|
|
|
2208
|
-
// src/adapters.ts
|
|
2209
|
-
import { withAdapterFallback } from "@joai/warps";
|
|
2210
|
-
|
|
2211
2377
|
// src/chains/somnia.ts
|
|
2212
|
-
import { WarpChainName as
|
|
2378
|
+
import { WarpChainName as WarpChainName17 } from "@joai/warps";
|
|
2213
2379
|
var NativeTokenSomi = {
|
|
2214
|
-
chain:
|
|
2380
|
+
chain: WarpChainName17.Somnia,
|
|
2215
2381
|
identifier: "SOMI",
|
|
2216
2382
|
symbol: "SOMI",
|
|
2217
2383
|
name: "Somnia",
|
|
@@ -2219,16 +2385,16 @@ var NativeTokenSomi = {
|
|
|
2219
2385
|
logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
|
|
2220
2386
|
};
|
|
2221
2387
|
var NativeTokenStt = {
|
|
2222
|
-
chain:
|
|
2388
|
+
chain: WarpChainName17.Somnia,
|
|
2223
2389
|
identifier: "STT",
|
|
2224
2390
|
symbol: "STT",
|
|
2225
2391
|
name: "Somnia Testnet Token",
|
|
2226
2392
|
decimals: 18,
|
|
2227
2393
|
logoUrl: "https://assets.coingecko.com/coins/images/68061/standard/somniacg.png?1754641117"
|
|
2228
2394
|
};
|
|
2229
|
-
var SomniaAdapter = createEvmAdapter(
|
|
2395
|
+
var SomniaAdapter = createEvmAdapter(WarpChainName17.Somnia, {
|
|
2230
2396
|
mainnet: {
|
|
2231
|
-
name:
|
|
2397
|
+
name: WarpChainName17.Somnia,
|
|
2232
2398
|
displayName: "Somnia Mainnet",
|
|
2233
2399
|
chainId: "5031",
|
|
2234
2400
|
blockTime: 100,
|
|
@@ -2238,7 +2404,7 @@ var SomniaAdapter = createEvmAdapter(WarpChainName15.Somnia, {
|
|
|
2238
2404
|
nativeToken: NativeTokenSomi
|
|
2239
2405
|
},
|
|
2240
2406
|
testnet: {
|
|
2241
|
-
name:
|
|
2407
|
+
name: WarpChainName17.Somnia,
|
|
2242
2408
|
displayName: "Somnia Testnet",
|
|
2243
2409
|
chainId: "50312",
|
|
2244
2410
|
blockTime: 100,
|
|
@@ -2248,7 +2414,7 @@ var SomniaAdapter = createEvmAdapter(WarpChainName15.Somnia, {
|
|
|
2248
2414
|
nativeToken: NativeTokenStt
|
|
2249
2415
|
},
|
|
2250
2416
|
devnet: {
|
|
2251
|
-
name:
|
|
2417
|
+
name: WarpChainName17.Somnia,
|
|
2252
2418
|
displayName: "Somnia Testnet",
|
|
2253
2419
|
chainId: "50312",
|
|
2254
2420
|
blockTime: 100,
|
|
@@ -2259,13 +2425,67 @@ var SomniaAdapter = createEvmAdapter(WarpChainName15.Somnia, {
|
|
|
2259
2425
|
}
|
|
2260
2426
|
});
|
|
2261
2427
|
|
|
2428
|
+
// src/chains/tempo.ts
|
|
2429
|
+
import { WarpAssets as WarpAssets3, WarpChainName as WarpChainName18 } from "@joai/warps";
|
|
2430
|
+
var NativeTokenTempo = {
|
|
2431
|
+
chain: WarpChainName18.Tempo,
|
|
2432
|
+
identifier: "USD",
|
|
2433
|
+
name: "USD",
|
|
2434
|
+
symbol: "USD",
|
|
2435
|
+
decimals: 6,
|
|
2436
|
+
logoUrl: WarpAssets3.tokenLogo("pathusd.svg")
|
|
2437
|
+
};
|
|
2438
|
+
var TempoAdapter = createEvmAdapter(WarpChainName18.Tempo, {
|
|
2439
|
+
mainnet: {
|
|
2440
|
+
name: WarpChainName18.Tempo,
|
|
2441
|
+
displayName: "Tempo",
|
|
2442
|
+
chainId: "4217",
|
|
2443
|
+
blockTime: 500,
|
|
2444
|
+
addressHrp: "0x",
|
|
2445
|
+
defaultApiUrl: "https://rpc.tempo.xyz",
|
|
2446
|
+
logoUrl: {
|
|
2447
|
+
light: WarpAssets3.chainLogo("tempo-white.svg"),
|
|
2448
|
+
dark: WarpAssets3.chainLogo("tempo-black.svg")
|
|
2449
|
+
},
|
|
2450
|
+
nativeToken: NativeTokenTempo
|
|
2451
|
+
},
|
|
2452
|
+
testnet: {
|
|
2453
|
+
name: WarpChainName18.Tempo,
|
|
2454
|
+
displayName: "Tempo Moderato",
|
|
2455
|
+
chainId: "42431",
|
|
2456
|
+
blockTime: 500,
|
|
2457
|
+
addressHrp: "0x",
|
|
2458
|
+
defaultApiUrl: "https://rpc.moderato.tempo.xyz",
|
|
2459
|
+
logoUrl: {
|
|
2460
|
+
light: WarpAssets3.chainLogo("tempo-white.svg"),
|
|
2461
|
+
dark: WarpAssets3.chainLogo("tempo-black.svg")
|
|
2462
|
+
},
|
|
2463
|
+
nativeToken: NativeTokenTempo
|
|
2464
|
+
},
|
|
2465
|
+
devnet: {
|
|
2466
|
+
name: WarpChainName18.Tempo,
|
|
2467
|
+
displayName: "Tempo Devnet",
|
|
2468
|
+
chainId: "31318",
|
|
2469
|
+
blockTime: 500,
|
|
2470
|
+
addressHrp: "0x",
|
|
2471
|
+
defaultApiUrl: "https://rpc.devnet.tempoxyz.dev",
|
|
2472
|
+
logoUrl: {
|
|
2473
|
+
light: WarpAssets3.chainLogo("tempo-white.svg"),
|
|
2474
|
+
dark: WarpAssets3.chainLogo("tempo-black.svg")
|
|
2475
|
+
},
|
|
2476
|
+
nativeToken: NativeTokenTempo
|
|
2477
|
+
}
|
|
2478
|
+
});
|
|
2479
|
+
|
|
2262
2480
|
// src/adapters.ts
|
|
2481
|
+
import { withAdapterFallback } from "@joai/warps";
|
|
2263
2482
|
var getAllEvmAdapters = (fallbackFactory) => [
|
|
2264
2483
|
withAdapterFallback(EthereumAdapter, fallbackFactory),
|
|
2265
2484
|
withAdapterFallback(BaseAdapter, fallbackFactory),
|
|
2266
2485
|
withAdapterFallback(ArbitrumAdapter, fallbackFactory),
|
|
2267
2486
|
withAdapterFallback(PolygonAdapter, fallbackFactory),
|
|
2268
|
-
withAdapterFallback(SomniaAdapter, fallbackFactory)
|
|
2487
|
+
withAdapterFallback(SomniaAdapter, fallbackFactory),
|
|
2488
|
+
withAdapterFallback(TempoAdapter, fallbackFactory)
|
|
2269
2489
|
];
|
|
2270
2490
|
export {
|
|
2271
2491
|
ArbitrumAdapter,
|
|
@@ -2283,9 +2503,15 @@ export {
|
|
|
2283
2503
|
NativeTokenBase,
|
|
2284
2504
|
NativeTokenEth,
|
|
2285
2505
|
NativeTokenPolygon,
|
|
2506
|
+
NativeTokenSomi,
|
|
2507
|
+
NativeTokenStt,
|
|
2508
|
+
NativeTokenTempo,
|
|
2286
2509
|
PolygonAdapter,
|
|
2287
2510
|
PolygonExplorers,
|
|
2511
|
+
SomniaAdapter,
|
|
2288
2512
|
SupportedEvmChainIds,
|
|
2513
|
+
TempoAdapter,
|
|
2514
|
+
TempoExplorers,
|
|
2289
2515
|
WarpEvmConstants,
|
|
2290
2516
|
WarpEvmDataLoader,
|
|
2291
2517
|
WarpEvmExecutor,
|