@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.mjs
CHANGED
|
@@ -457,7 +457,7 @@ var WarpEvmDataLoader = class {
|
|
|
457
457
|
|
|
458
458
|
// src/WarpEvmExecutor.ts
|
|
459
459
|
import {
|
|
460
|
-
|
|
460
|
+
applyOutputToMessages,
|
|
461
461
|
getNextInfo,
|
|
462
462
|
getProviderConfig as getProviderConfig3,
|
|
463
463
|
getWarpActionByIndex,
|
|
@@ -540,12 +540,12 @@ var ExplorerUrls = {
|
|
|
540
540
|
["blockscout_base_sepolia" /* BlockscoutBaseSepolia */]: "https://sepolia.blockscout.com"
|
|
541
541
|
};
|
|
542
542
|
|
|
543
|
-
// src/
|
|
543
|
+
// src/WarpEvmOutput.ts
|
|
544
544
|
import {
|
|
545
|
-
|
|
545
|
+
evaluateOutputCommon,
|
|
546
546
|
getProviderConfig as getProviderConfig2,
|
|
547
547
|
getWarpWalletAddressFromConfig,
|
|
548
|
-
|
|
548
|
+
parseOutputOutIndex,
|
|
549
549
|
WarpConstants as WarpConstants2
|
|
550
550
|
} from "@vleap/warps";
|
|
551
551
|
import { ethers as ethers3 } from "ethers";
|
|
@@ -705,8 +705,8 @@ var WarpEvmSerializer = class {
|
|
|
705
705
|
}
|
|
706
706
|
};
|
|
707
707
|
|
|
708
|
-
// src/
|
|
709
|
-
var
|
|
708
|
+
// src/WarpEvmOutput.ts
|
|
709
|
+
var WarpEvmOutput = class {
|
|
710
710
|
constructor(config, chain) {
|
|
711
711
|
this.config = config;
|
|
712
712
|
this.chain = chain;
|
|
@@ -726,7 +726,7 @@ var WarpEvmResults = class {
|
|
|
726
726
|
}
|
|
727
727
|
createFailedExecution(warp, actionIndex) {
|
|
728
728
|
return {
|
|
729
|
-
|
|
729
|
+
status: "error",
|
|
730
730
|
warp,
|
|
731
731
|
action: actionIndex,
|
|
732
732
|
user: getWarpWalletAddressFromConfig(this.config, this.chain.name),
|
|
@@ -734,7 +734,7 @@ var WarpEvmResults = class {
|
|
|
734
734
|
tx: null,
|
|
735
735
|
next: null,
|
|
736
736
|
values: { string: [], native: [] },
|
|
737
|
-
|
|
737
|
+
output: {},
|
|
738
738
|
messages: {}
|
|
739
739
|
};
|
|
740
740
|
}
|
|
@@ -747,7 +747,7 @@ var WarpEvmResults = class {
|
|
|
747
747
|
const rawValues = [transactionHash, blockNumber, gasUsed, gasPrice];
|
|
748
748
|
const stringValues = rawValues.map(String);
|
|
749
749
|
return {
|
|
750
|
-
success,
|
|
750
|
+
status: success ? "success" : "error",
|
|
751
751
|
warp,
|
|
752
752
|
action: actionIndex,
|
|
753
753
|
user: getWarpWalletAddressFromConfig(this.config, this.chain.name),
|
|
@@ -755,7 +755,7 @@ var WarpEvmResults = class {
|
|
|
755
755
|
tx,
|
|
756
756
|
next: null,
|
|
757
757
|
values: { string: stringValues, native: rawValues },
|
|
758
|
-
|
|
758
|
+
output: {},
|
|
759
759
|
messages: {}
|
|
760
760
|
};
|
|
761
761
|
}
|
|
@@ -776,7 +776,7 @@ var WarpEvmResults = class {
|
|
|
776
776
|
const rawValues = [transactionHash, blockNumber, gasUsed, gasPrice, ...logs.length > 0 ? logs : []];
|
|
777
777
|
const stringValues = rawValues.map(String);
|
|
778
778
|
return {
|
|
779
|
-
success,
|
|
779
|
+
status: success ? "success" : "error",
|
|
780
780
|
warp,
|
|
781
781
|
action: actionIndex,
|
|
782
782
|
user: getWarpWalletAddressFromConfig(this.config, this.chain.name),
|
|
@@ -784,16 +784,16 @@ var WarpEvmResults = class {
|
|
|
784
784
|
tx,
|
|
785
785
|
next: null,
|
|
786
786
|
values: { string: stringValues, native: rawValues },
|
|
787
|
-
|
|
787
|
+
output: {},
|
|
788
788
|
messages: {}
|
|
789
789
|
};
|
|
790
790
|
}
|
|
791
|
-
async
|
|
791
|
+
async extractQueryOutput(warp, typedValues, actionIndex, inputs) {
|
|
792
792
|
const stringValues = typedValues.map((t) => this.serializer.typedToString(t));
|
|
793
793
|
const nativeValues = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
|
|
794
794
|
const values = { string: stringValues, native: nativeValues };
|
|
795
|
-
let
|
|
796
|
-
if (!warp.
|
|
795
|
+
let output = {};
|
|
796
|
+
if (!warp.output) return { values, output };
|
|
797
797
|
const getNestedValue = (path) => {
|
|
798
798
|
const indices = path.split(".").slice(1).map((i) => parseInt(i) - 1);
|
|
799
799
|
if (indices.length === 0) return void 0;
|
|
@@ -804,20 +804,20 @@ var WarpEvmResults = class {
|
|
|
804
804
|
}
|
|
805
805
|
return value;
|
|
806
806
|
};
|
|
807
|
-
for (const [key, path] of Object.entries(warp.
|
|
807
|
+
for (const [key, path] of Object.entries(warp.output)) {
|
|
808
808
|
if (path.startsWith(WarpConstants2.Transform.Prefix)) continue;
|
|
809
|
-
const currentActionIndex =
|
|
809
|
+
const currentActionIndex = parseOutputOutIndex(path);
|
|
810
810
|
if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
|
|
811
|
-
|
|
811
|
+
output[key] = null;
|
|
812
812
|
continue;
|
|
813
813
|
}
|
|
814
814
|
if (path.startsWith("out.") || path === "out" || path.startsWith("out[")) {
|
|
815
|
-
|
|
815
|
+
output[key] = getNestedValue(path) || null;
|
|
816
816
|
} else {
|
|
817
|
-
|
|
817
|
+
output[key] = path;
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
return { values,
|
|
820
|
+
return { values, output: await evaluateOutputCommon(warp, output, actionIndex, inputs, this.serializer.coreSerializer, this.config) };
|
|
821
821
|
}
|
|
822
822
|
async getTransactionStatus(txHash) {
|
|
823
823
|
try {
|
|
@@ -852,7 +852,7 @@ var WarpEvmExecutor = class {
|
|
|
852
852
|
const providerConfig = getProviderConfig3(this.config, chain.name, this.config.env, this.chain.defaultApiUrl);
|
|
853
853
|
const network = new ethers4.Network(this.chain.name, parseInt(this.chain.chainId));
|
|
854
854
|
this.provider = new ethers4.JsonRpcProvider(providerConfig.url, network);
|
|
855
|
-
this.
|
|
855
|
+
this.output = new WarpEvmOutput(config, this.chain);
|
|
856
856
|
}
|
|
857
857
|
async createTransaction(executable) {
|
|
858
858
|
const action = getWarpActionByIndex(executable.warp, executable.action);
|
|
@@ -964,15 +964,15 @@ var WarpEvmExecutor = class {
|
|
|
964
964
|
});
|
|
965
965
|
const decodedResult = iface.decodeFunctionResult(action.func, result);
|
|
966
966
|
const isSuccess = true;
|
|
967
|
-
const { values,
|
|
967
|
+
const { values, output } = await this.output.extractQueryOutput(
|
|
968
968
|
executable.warp,
|
|
969
969
|
decodedResult,
|
|
970
970
|
executable.action,
|
|
971
971
|
executable.resolvedInputs
|
|
972
972
|
);
|
|
973
|
-
const next = getNextInfo(this.config, [], executable.warp, executable.action,
|
|
973
|
+
const next = getNextInfo(this.config, [], executable.warp, executable.action, output);
|
|
974
974
|
return {
|
|
975
|
-
success:
|
|
975
|
+
status: isSuccess ? "success" : "error",
|
|
976
976
|
warp: executable.warp,
|
|
977
977
|
action: executable.action,
|
|
978
978
|
user: getWarpWalletAddressFromConfig2(this.config, executable.chain.name),
|
|
@@ -980,12 +980,12 @@ var WarpEvmExecutor = class {
|
|
|
980
980
|
tx: null,
|
|
981
981
|
next,
|
|
982
982
|
values,
|
|
983
|
-
|
|
984
|
-
messages:
|
|
983
|
+
output: { ...output, _DATA: decodedResult },
|
|
984
|
+
messages: applyOutputToMessages(executable.warp, output)
|
|
985
985
|
};
|
|
986
986
|
} catch (error) {
|
|
987
987
|
return {
|
|
988
|
-
|
|
988
|
+
status: "error",
|
|
989
989
|
warp: executable.warp,
|
|
990
990
|
action: executable.action,
|
|
991
991
|
user: getWarpWalletAddressFromConfig2(this.config, executable.chain.name),
|
|
@@ -993,7 +993,7 @@ var WarpEvmExecutor = class {
|
|
|
993
993
|
tx: null,
|
|
994
994
|
next: null,
|
|
995
995
|
values: { string: [], native: [] },
|
|
996
|
-
|
|
996
|
+
output: { _DATA: error },
|
|
997
997
|
messages: {}
|
|
998
998
|
};
|
|
999
999
|
}
|
|
@@ -1284,7 +1284,7 @@ var createEvmAdapter = (chainName, chainInfos) => {
|
|
|
1284
1284
|
chainInfo: chainInfos[config.env],
|
|
1285
1285
|
builder: () => fallback.builder(),
|
|
1286
1286
|
executor: new WarpEvmExecutor(config, chainInfos[config.env]),
|
|
1287
|
-
|
|
1287
|
+
output: new WarpEvmOutput(config, chainInfos[config.env]),
|
|
1288
1288
|
serializer: new WarpEvmSerializer(),
|
|
1289
1289
|
registry: fallback.registry,
|
|
1290
1290
|
explorer: new WarpEvmExplorer(chainInfos[config.env], config),
|
|
@@ -1506,7 +1506,7 @@ export {
|
|
|
1506
1506
|
WarpEvmDataLoader,
|
|
1507
1507
|
WarpEvmExecutor,
|
|
1508
1508
|
WarpEvmExplorer,
|
|
1509
|
-
|
|
1509
|
+
WarpEvmOutput,
|
|
1510
1510
|
WarpEvmSerializer,
|
|
1511
1511
|
WarpEvmWallet,
|
|
1512
1512
|
createEvmAdapter,
|