@vleap/warps-adapter-evm 0.2.0-alpha.41 → 0.2.0-alpha.42
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 +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +29 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable,
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecutionResult, AdapterWarpExplorer, AdapterWarpOutput, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionOutput, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
|
|
4
4
|
declare const NativeTokenArb: WarpChainAsset;
|
|
@@ -165,14 +165,14 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
|
|
|
165
165
|
private readonly chain;
|
|
166
166
|
private readonly serializer;
|
|
167
167
|
private readonly provider;
|
|
168
|
-
private readonly
|
|
168
|
+
private readonly output;
|
|
169
169
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
170
170
|
createTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
171
171
|
createTransferTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
172
172
|
createContractCallTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
173
173
|
private createTokenTransferTransaction;
|
|
174
174
|
private createSingleTokenTransfer;
|
|
175
|
-
executeQuery(executable: WarpExecutable): Promise<
|
|
175
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
|
|
176
176
|
private estimateGasAndSetDefaults;
|
|
177
177
|
verifyMessage(message: string, signature: string): Promise<string>;
|
|
178
178
|
}
|
|
@@ -198,22 +198,22 @@ declare class WarpEvmExplorer implements AdapterWarpExplorer {
|
|
|
198
198
|
getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
declare class
|
|
201
|
+
declare class WarpEvmOutput implements AdapterWarpOutput {
|
|
202
202
|
private readonly config;
|
|
203
203
|
private readonly chain;
|
|
204
204
|
private readonly serializer;
|
|
205
205
|
private readonly provider;
|
|
206
206
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
207
|
-
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<
|
|
207
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
|
|
208
208
|
private createFailedExecution;
|
|
209
209
|
private handleWarpChainAction;
|
|
210
210
|
private handleTransactionReceipt;
|
|
211
|
-
|
|
211
|
+
extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
212
212
|
values: {
|
|
213
213
|
string: string[];
|
|
214
214
|
native: WarpNativeValue[];
|
|
215
215
|
};
|
|
216
|
-
|
|
216
|
+
output: WarpExecutionOutput;
|
|
217
217
|
}>;
|
|
218
218
|
getTransactionStatus(txHash: string): Promise<{
|
|
219
219
|
status: 'pending' | 'confirmed' | 'failed';
|
|
@@ -258,4 +258,4 @@ declare class WarpEvmWallet implements AdapterWarpWallet {
|
|
|
258
258
|
private getWallet;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
export { ArbitrumExplorers, BaseExplorers, EthereumExplorers, EvmExplorers, type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenArb, NativeTokenBase, NativeTokenEth, type TokenBalance, type TokenInfo, type TokenListResponse, type TokenMetadata, UniswapService, type UniswapToken, type UniswapTokenList, WarpEvmConstants, WarpEvmDataLoader, WarpEvmExecutor, WarpEvmExplorer,
|
|
261
|
+
export { ArbitrumExplorers, BaseExplorers, EthereumExplorers, EvmExplorers, type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenArb, NativeTokenBase, NativeTokenEth, type TokenBalance, type TokenInfo, type TokenListResponse, type TokenMetadata, UniswapService, type UniswapToken, type UniswapTokenList, WarpEvmConstants, WarpEvmDataLoader, WarpEvmExecutor, WarpEvmExplorer, WarpEvmOutput, WarpEvmSerializer, WarpEvmWallet, createEvmAdapter, findKnownTokenById, getAllEvmAdapters, getAllEvmChainNames, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getKnownTokensForChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable,
|
|
1
|
+
import { WarpChainAsset, AdapterFactory, WarpClientConfig, Adapter, WarpChain, WarpChainEnv, WarpChainInfo, WarpCache, AdapterWarpDataLoader, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionExecutionResult, AdapterWarpExplorer, AdapterWarpOutput, Warp, WarpActionIndex, WarpAdapterGenericRemoteTransaction, ResolvedInput, WarpNativeValue, WarpExecutionOutput, AdapterWarpSerializer, WarpSerializer, WarpActionInputType, BaseWarpActionInputType, WarpAdapterGenericType, AdapterWarpWallet, WarpAdapterGenericTransaction } from '@vleap/warps';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
|
|
4
4
|
declare const NativeTokenArb: WarpChainAsset;
|
|
@@ -165,14 +165,14 @@ declare class WarpEvmExecutor implements AdapterWarpExecutor {
|
|
|
165
165
|
private readonly chain;
|
|
166
166
|
private readonly serializer;
|
|
167
167
|
private readonly provider;
|
|
168
|
-
private readonly
|
|
168
|
+
private readonly output;
|
|
169
169
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
170
170
|
createTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
171
171
|
createTransferTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
172
172
|
createContractCallTransaction(executable: WarpExecutable): Promise<ethers.TransactionRequest>;
|
|
173
173
|
private createTokenTransferTransaction;
|
|
174
174
|
private createSingleTokenTransfer;
|
|
175
|
-
executeQuery(executable: WarpExecutable): Promise<
|
|
175
|
+
executeQuery(executable: WarpExecutable): Promise<WarpActionExecutionResult>;
|
|
176
176
|
private estimateGasAndSetDefaults;
|
|
177
177
|
verifyMessage(message: string, signature: string): Promise<string>;
|
|
178
178
|
}
|
|
@@ -198,22 +198,22 @@ declare class WarpEvmExplorer implements AdapterWarpExplorer {
|
|
|
198
198
|
getBlockUrls(blockNumber: string | number): Record<ExplorerName, string>;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
declare class
|
|
201
|
+
declare class WarpEvmOutput implements AdapterWarpOutput {
|
|
202
202
|
private readonly config;
|
|
203
203
|
private readonly chain;
|
|
204
204
|
private readonly serializer;
|
|
205
205
|
private readonly provider;
|
|
206
206
|
constructor(config: WarpClientConfig, chain: WarpChainInfo);
|
|
207
|
-
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<
|
|
207
|
+
getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
|
|
208
208
|
private createFailedExecution;
|
|
209
209
|
private handleWarpChainAction;
|
|
210
210
|
private handleTransactionReceipt;
|
|
211
|
-
|
|
211
|
+
extractQueryOutput(warp: Warp, typedValues: unknown[], actionIndex: number, inputs: ResolvedInput[]): Promise<{
|
|
212
212
|
values: {
|
|
213
213
|
string: string[];
|
|
214
214
|
native: WarpNativeValue[];
|
|
215
215
|
};
|
|
216
|
-
|
|
216
|
+
output: WarpExecutionOutput;
|
|
217
217
|
}>;
|
|
218
218
|
getTransactionStatus(txHash: string): Promise<{
|
|
219
219
|
status: 'pending' | 'confirmed' | 'failed';
|
|
@@ -258,4 +258,4 @@ declare class WarpEvmWallet implements AdapterWarpWallet {
|
|
|
258
258
|
private getWallet;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
export { ArbitrumExplorers, BaseExplorers, EthereumExplorers, EvmExplorers, type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenArb, NativeTokenBase, NativeTokenEth, type TokenBalance, type TokenInfo, type TokenListResponse, type TokenMetadata, UniswapService, type UniswapToken, type UniswapTokenList, WarpEvmConstants, WarpEvmDataLoader, WarpEvmExecutor, WarpEvmExplorer,
|
|
261
|
+
export { ArbitrumExplorers, BaseExplorers, EthereumExplorers, EvmExplorers, type ExplorerName, ExplorerUrls, KnownTokens, NativeTokenArb, NativeTokenBase, NativeTokenEth, type TokenBalance, type TokenInfo, type TokenListResponse, type TokenMetadata, UniswapService, type UniswapToken, type UniswapTokenList, WarpEvmConstants, WarpEvmDataLoader, WarpEvmExecutor, WarpEvmExplorer, WarpEvmOutput, WarpEvmSerializer, WarpEvmWallet, createEvmAdapter, findKnownTokenById, getAllEvmAdapters, getAllEvmChainNames, getArbitrumAdapter, getBaseAdapter, getEthereumAdapter, getKnownTokensForChain };
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
WarpEvmDataLoader: () => WarpEvmDataLoader,
|
|
35
35
|
WarpEvmExecutor: () => WarpEvmExecutor,
|
|
36
36
|
WarpEvmExplorer: () => WarpEvmExplorer,
|
|
37
|
-
|
|
37
|
+
WarpEvmOutput: () => WarpEvmOutput,
|
|
38
38
|
WarpEvmSerializer: () => WarpEvmSerializer,
|
|
39
39
|
WarpEvmWallet: () => WarpEvmWallet,
|
|
40
40
|
createEvmAdapter: () => createEvmAdapter,
|
|
@@ -579,7 +579,7 @@ var ExplorerUrls = {
|
|
|
579
579
|
["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com"
|
|
580
580
|
};
|
|
581
581
|
|
|
582
|
-
// src/
|
|
582
|
+
// src/WarpEvmOutput.ts
|
|
583
583
|
var import_warps9 = require("@vleap/warps");
|
|
584
584
|
var import_ethers3 = require("ethers");
|
|
585
585
|
|
|
@@ -735,8 +735,8 @@ var WarpEvmSerializer = class {
|
|
|
735
735
|
}
|
|
736
736
|
};
|
|
737
737
|
|
|
738
|
-
// src/
|
|
739
|
-
var
|
|
738
|
+
// src/WarpEvmOutput.ts
|
|
739
|
+
var WarpEvmOutput = class {
|
|
740
740
|
constructor(config, chain) {
|
|
741
741
|
this.config = config;
|
|
742
742
|
this.chain = chain;
|
|
@@ -756,7 +756,7 @@ var WarpEvmResults = class {
|
|
|
756
756
|
}
|
|
757
757
|
createFailedExecution(warp, actionIndex) {
|
|
758
758
|
return {
|
|
759
|
-
|
|
759
|
+
status: "error",
|
|
760
760
|
warp,
|
|
761
761
|
action: actionIndex,
|
|
762
762
|
user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
@@ -764,7 +764,7 @@ var WarpEvmResults = class {
|
|
|
764
764
|
tx: null,
|
|
765
765
|
next: null,
|
|
766
766
|
values: { string: [], native: [] },
|
|
767
|
-
|
|
767
|
+
output: {},
|
|
768
768
|
messages: {}
|
|
769
769
|
};
|
|
770
770
|
}
|
|
@@ -777,7 +777,7 @@ var WarpEvmResults = class {
|
|
|
777
777
|
const rawValues = [transactionHash, blockNumber, gasUsed, gasPrice];
|
|
778
778
|
const stringValues = rawValues.map(String);
|
|
779
779
|
return {
|
|
780
|
-
success,
|
|
780
|
+
status: success ? "success" : "error",
|
|
781
781
|
warp,
|
|
782
782
|
action: actionIndex,
|
|
783
783
|
user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
@@ -785,7 +785,7 @@ var WarpEvmResults = class {
|
|
|
785
785
|
tx,
|
|
786
786
|
next: null,
|
|
787
787
|
values: { string: stringValues, native: rawValues },
|
|
788
|
-
|
|
788
|
+
output: {},
|
|
789
789
|
messages: {}
|
|
790
790
|
};
|
|
791
791
|
}
|
|
@@ -806,7 +806,7 @@ var WarpEvmResults = class {
|
|
|
806
806
|
const rawValues = [transactionHash, blockNumber, gasUsed, gasPrice, ...logs.length > 0 ? logs : []];
|
|
807
807
|
const stringValues = rawValues.map(String);
|
|
808
808
|
return {
|
|
809
|
-
success,
|
|
809
|
+
status: success ? "success" : "error",
|
|
810
810
|
warp,
|
|
811
811
|
action: actionIndex,
|
|
812
812
|
user: (0, import_warps9.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
@@ -814,16 +814,16 @@ var WarpEvmResults = class {
|
|
|
814
814
|
tx,
|
|
815
815
|
next: null,
|
|
816
816
|
values: { string: stringValues, native: rawValues },
|
|
817
|
-
|
|
817
|
+
output: {},
|
|
818
818
|
messages: {}
|
|
819
819
|
};
|
|
820
820
|
}
|
|
821
|
-
async
|
|
821
|
+
async extractQueryOutput(warp, typedValues, actionIndex, inputs) {
|
|
822
822
|
const stringValues = typedValues.map((t) => this.serializer.typedToString(t));
|
|
823
823
|
const nativeValues = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
|
|
824
824
|
const values = { string: stringValues, native: nativeValues };
|
|
825
|
-
let
|
|
826
|
-
if (!warp.
|
|
825
|
+
let output = {};
|
|
826
|
+
if (!warp.output) return { values, output };
|
|
827
827
|
const getNestedValue = (path) => {
|
|
828
828
|
const indices = path.split(".").slice(1).map((i) => parseInt(i) - 1);
|
|
829
829
|
if (indices.length === 0) return void 0;
|
|
@@ -834,20 +834,20 @@ var WarpEvmResults = class {
|
|
|
834
834
|
}
|
|
835
835
|
return value;
|
|
836
836
|
};
|
|
837
|
-
for (const [key, path] of Object.entries(warp.
|
|
837
|
+
for (const [key, path] of Object.entries(warp.output)) {
|
|
838
838
|
if (path.startsWith(import_warps9.WarpConstants.Transform.Prefix)) continue;
|
|
839
|
-
const currentActionIndex = (0, import_warps9.
|
|
839
|
+
const currentActionIndex = (0, import_warps9.parseOutputOutIndex)(path);
|
|
840
840
|
if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
|
|
841
|
-
|
|
841
|
+
output[key] = null;
|
|
842
842
|
continue;
|
|
843
843
|
}
|
|
844
844
|
if (path.startsWith("out.") || path === "out" || path.startsWith("out[")) {
|
|
845
|
-
|
|
845
|
+
output[key] = getNestedValue(path) || null;
|
|
846
846
|
} else {
|
|
847
|
-
|
|
847
|
+
output[key] = path;
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
-
return { values,
|
|
850
|
+
return { values, output: await (0, import_warps9.evaluateOutputCommon)(warp, output, actionIndex, inputs, this.serializer.coreSerializer, this.config) };
|
|
851
851
|
}
|
|
852
852
|
async getTransactionStatus(txHash) {
|
|
853
853
|
try {
|
|
@@ -882,7 +882,7 @@ var WarpEvmExecutor = class {
|
|
|
882
882
|
const providerConfig = (0, import_warps10.getProviderConfig)(this.config, chain.name, this.config.env, this.chain.defaultApiUrl);
|
|
883
883
|
const network = new import_ethers4.ethers.Network(this.chain.name, parseInt(this.chain.chainId));
|
|
884
884
|
this.provider = new import_ethers4.ethers.JsonRpcProvider(providerConfig.url, network);
|
|
885
|
-
this.
|
|
885
|
+
this.output = new WarpEvmOutput(config, this.chain);
|
|
886
886
|
}
|
|
887
887
|
async createTransaction(executable) {
|
|
888
888
|
const action = (0, import_warps10.getWarpActionByIndex)(executable.warp, executable.action);
|
|
@@ -994,15 +994,15 @@ var WarpEvmExecutor = class {
|
|
|
994
994
|
});
|
|
995
995
|
const decodedResult = iface.decodeFunctionResult(action.func, result);
|
|
996
996
|
const isSuccess = true;
|
|
997
|
-
const { values,
|
|
997
|
+
const { values, output } = await this.output.extractQueryOutput(
|
|
998
998
|
executable.warp,
|
|
999
999
|
decodedResult,
|
|
1000
1000
|
executable.action,
|
|
1001
1001
|
executable.resolvedInputs
|
|
1002
1002
|
);
|
|
1003
|
-
const next = (0, import_warps10.getNextInfo)(this.config, [], executable.warp, executable.action,
|
|
1003
|
+
const next = (0, import_warps10.getNextInfo)(this.config, [], executable.warp, executable.action, output);
|
|
1004
1004
|
return {
|
|
1005
|
-
success:
|
|
1005
|
+
status: isSuccess ? "success" : "error",
|
|
1006
1006
|
warp: executable.warp,
|
|
1007
1007
|
action: executable.action,
|
|
1008
1008
|
user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
|
|
@@ -1010,12 +1010,12 @@ var WarpEvmExecutor = class {
|
|
|
1010
1010
|
tx: null,
|
|
1011
1011
|
next,
|
|
1012
1012
|
values,
|
|
1013
|
-
|
|
1014
|
-
messages: (0, import_warps10.
|
|
1013
|
+
output: { ...output, _DATA: decodedResult },
|
|
1014
|
+
messages: (0, import_warps10.applyOutputToMessages)(executable.warp, output)
|
|
1015
1015
|
};
|
|
1016
1016
|
} catch (error) {
|
|
1017
1017
|
return {
|
|
1018
|
-
|
|
1018
|
+
status: "error",
|
|
1019
1019
|
warp: executable.warp,
|
|
1020
1020
|
action: executable.action,
|
|
1021
1021
|
user: (0, import_warps10.getWarpWalletAddressFromConfig)(this.config, executable.chain.name),
|
|
@@ -1023,7 +1023,7 @@ var WarpEvmExecutor = class {
|
|
|
1023
1023
|
tx: null,
|
|
1024
1024
|
next: null,
|
|
1025
1025
|
values: { string: [], native: [] },
|
|
1026
|
-
|
|
1026
|
+
output: { _DATA: error },
|
|
1027
1027
|
messages: {}
|
|
1028
1028
|
};
|
|
1029
1029
|
}
|
|
@@ -1310,7 +1310,7 @@ var createEvmAdapter = (chainName, chainInfos) => {
|
|
|
1310
1310
|
chainInfo: chainInfos[config.env],
|
|
1311
1311
|
builder: () => fallback.builder(),
|
|
1312
1312
|
executor: new WarpEvmExecutor(config, chainInfos[config.env]),
|
|
1313
|
-
|
|
1313
|
+
output: new WarpEvmOutput(config, chainInfos[config.env]),
|
|
1314
1314
|
serializer: new WarpEvmSerializer(),
|
|
1315
1315
|
registry: fallback.registry,
|
|
1316
1316
|
explorer: new WarpEvmExplorer(chainInfos[config.env], config),
|
|
@@ -1533,7 +1533,7 @@ var getAllEvmChainNames = () => [
|
|
|
1533
1533
|
WarpEvmDataLoader,
|
|
1534
1534
|
WarpEvmExecutor,
|
|
1535
1535
|
WarpEvmExplorer,
|
|
1536
|
-
|
|
1536
|
+
WarpEvmOutput,
|
|
1537
1537
|
WarpEvmSerializer,
|
|
1538
1538
|
WarpEvmWallet,
|
|
1539
1539
|
createEvmAdapter,
|