@vleap/warps-adapter-fastset 0.1.0-alpha.36 → 0.1.0-alpha.38
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.js +18 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1659,6 +1659,7 @@ var WarpFastsetExecutor = class {
|
|
|
1659
1659
|
throw new Error(`WarpFastsetExecutor: Invalid action type (${action.type})`);
|
|
1660
1660
|
}
|
|
1661
1661
|
async createTransferTransaction(executable) {
|
|
1662
|
+
if (!executable.destination) throw new Error("WarpFastsetExecutor: createTransfer - destination not set");
|
|
1662
1663
|
const userWallet = (0, import_warps2.getWarpWalletAddressFromConfig)(this.config, executable.chain.name);
|
|
1663
1664
|
if (!userWallet) throw new Error("WarpFastsetExecutor: createTransfer - user address not set");
|
|
1664
1665
|
const senderPubKey = FastsetClient.decodeBech32Address(userWallet);
|
|
@@ -1723,7 +1724,7 @@ var WarpFastsetExplorer = class {
|
|
|
1723
1724
|
}
|
|
1724
1725
|
};
|
|
1725
1726
|
|
|
1726
|
-
// src/
|
|
1727
|
+
// src/WarpFastsetOutput.ts
|
|
1727
1728
|
var import_warps4 = require("@vleap/warps");
|
|
1728
1729
|
|
|
1729
1730
|
// src/WarpFastsetSerializer.ts
|
|
@@ -1836,8 +1837,8 @@ var WarpFastsetSerializer = class {
|
|
|
1836
1837
|
}
|
|
1837
1838
|
};
|
|
1838
1839
|
|
|
1839
|
-
// src/
|
|
1840
|
-
var
|
|
1840
|
+
// src/WarpFastsetOutput.ts
|
|
1841
|
+
var WarpFastsetOutput = class {
|
|
1841
1842
|
constructor(config, chain2) {
|
|
1842
1843
|
this.config = config;
|
|
1843
1844
|
this.chain = chain2;
|
|
@@ -1851,7 +1852,7 @@ var WarpFastsetResults = class {
|
|
|
1851
1852
|
const rawValues = [transactionHash, blockNumber, timestamp];
|
|
1852
1853
|
const stringValues = rawValues.map((v) => String(v));
|
|
1853
1854
|
return {
|
|
1854
|
-
success,
|
|
1855
|
+
status: success ? "success" : "error",
|
|
1855
1856
|
warp,
|
|
1856
1857
|
action: 0,
|
|
1857
1858
|
user: (0, import_warps4.getWarpWalletAddressFromConfig)(this.config, this.chain.name),
|
|
@@ -1859,16 +1860,16 @@ var WarpFastsetResults = class {
|
|
|
1859
1860
|
tx,
|
|
1860
1861
|
next: null,
|
|
1861
1862
|
values: { string: stringValues, native: rawValues },
|
|
1862
|
-
|
|
1863
|
+
output: {},
|
|
1863
1864
|
messages: {}
|
|
1864
1865
|
};
|
|
1865
1866
|
}
|
|
1866
|
-
async
|
|
1867
|
+
async extractQueryOutput(warp, typedValues, actionIndex, inputs) {
|
|
1867
1868
|
const stringValues = typedValues.map((t) => this.serializer.typedToString(t));
|
|
1868
1869
|
const nativeValues = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
|
|
1869
1870
|
const values = { string: stringValues, native: nativeValues };
|
|
1870
|
-
let
|
|
1871
|
-
if (!warp.
|
|
1871
|
+
let output = {};
|
|
1872
|
+
if (!warp.output) return { values, output };
|
|
1872
1873
|
const getNestedValue = (path) => {
|
|
1873
1874
|
const match = path.match(/^out\[(\d+)\]$/);
|
|
1874
1875
|
if (match) {
|
|
@@ -1884,25 +1885,25 @@ var WarpFastsetResults = class {
|
|
|
1884
1885
|
}
|
|
1885
1886
|
return value;
|
|
1886
1887
|
};
|
|
1887
|
-
for (const [key, path] of Object.entries(warp.
|
|
1888
|
+
for (const [key, path] of Object.entries(warp.output)) {
|
|
1888
1889
|
if (path.startsWith(import_warps4.WarpConstants.Transform.Prefix)) continue;
|
|
1889
|
-
const currentActionIndex = (0, import_warps4.
|
|
1890
|
+
const currentActionIndex = (0, import_warps4.parseOutputOutIndex)(path);
|
|
1890
1891
|
if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
|
|
1891
|
-
|
|
1892
|
+
output[key] = null;
|
|
1892
1893
|
continue;
|
|
1893
1894
|
}
|
|
1894
1895
|
if (path.startsWith("out.") || path === "out" || path.startsWith("out[")) {
|
|
1895
1896
|
const value = getNestedValue(path);
|
|
1896
|
-
|
|
1897
|
+
output[key] = value || null;
|
|
1897
1898
|
} else {
|
|
1898
|
-
|
|
1899
|
+
output[key] = path;
|
|
1899
1900
|
}
|
|
1900
1901
|
}
|
|
1901
1902
|
return {
|
|
1902
1903
|
values,
|
|
1903
|
-
|
|
1904
|
+
output: await (0, import_warps4.evaluateOutputCommon)(
|
|
1904
1905
|
warp,
|
|
1905
|
-
|
|
1906
|
+
output,
|
|
1906
1907
|
actionIndex,
|
|
1907
1908
|
inputs,
|
|
1908
1909
|
this.serializer.coreSerializer,
|
|
@@ -2918,7 +2919,7 @@ var WarpFastsetWallet = class {
|
|
|
2918
2919
|
}
|
|
2919
2920
|
async sendTransaction(tx) {
|
|
2920
2921
|
const { signature, ...transactionWithoutSignature } = tx;
|
|
2921
|
-
const _cert = await this.client.submitTransaction(transactionWithoutSignature, signature);
|
|
2922
|
+
const _cert = await this.client.submitTransaction(transactionWithoutSignature, signature ?? null);
|
|
2922
2923
|
return "TODO";
|
|
2923
2924
|
}
|
|
2924
2925
|
async sendTransactions(txs) {
|
|
@@ -2960,7 +2961,7 @@ function createFastsetAdapter(chainName, chainInfos) {
|
|
|
2960
2961
|
chainInfo,
|
|
2961
2962
|
builder: () => fallback.builder(),
|
|
2962
2963
|
executor: new WarpFastsetExecutor(config, chainInfo),
|
|
2963
|
-
|
|
2964
|
+
output: new WarpFastsetOutput(config, chainInfo),
|
|
2964
2965
|
serializer: new WarpFastsetSerializer(),
|
|
2965
2966
|
registry: fallback.registry,
|
|
2966
2967
|
explorer: new WarpFastsetExplorer(chainInfo, config),
|