@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.mjs
CHANGED
|
@@ -1631,6 +1631,7 @@ var WarpFastsetExecutor = class {
|
|
|
1631
1631
|
throw new Error(`WarpFastsetExecutor: Invalid action type (${action.type})`);
|
|
1632
1632
|
}
|
|
1633
1633
|
async createTransferTransaction(executable) {
|
|
1634
|
+
if (!executable.destination) throw new Error("WarpFastsetExecutor: createTransfer - destination not set");
|
|
1634
1635
|
const userWallet = getWarpWalletAddressFromConfig(this.config, executable.chain.name);
|
|
1635
1636
|
if (!userWallet) throw new Error("WarpFastsetExecutor: createTransfer - user address not set");
|
|
1636
1637
|
const senderPubKey = FastsetClient.decodeBech32Address(userWallet);
|
|
@@ -1695,11 +1696,11 @@ var WarpFastsetExplorer = class {
|
|
|
1695
1696
|
}
|
|
1696
1697
|
};
|
|
1697
1698
|
|
|
1698
|
-
// src/
|
|
1699
|
+
// src/WarpFastsetOutput.ts
|
|
1699
1700
|
import {
|
|
1700
|
-
|
|
1701
|
+
evaluateOutputCommon,
|
|
1701
1702
|
getWarpWalletAddressFromConfig as getWarpWalletAddressFromConfig2,
|
|
1702
|
-
|
|
1703
|
+
parseOutputOutIndex,
|
|
1703
1704
|
WarpConstants
|
|
1704
1705
|
} from "@vleap/warps";
|
|
1705
1706
|
|
|
@@ -1815,8 +1816,8 @@ var WarpFastsetSerializer = class {
|
|
|
1815
1816
|
}
|
|
1816
1817
|
};
|
|
1817
1818
|
|
|
1818
|
-
// src/
|
|
1819
|
-
var
|
|
1819
|
+
// src/WarpFastsetOutput.ts
|
|
1820
|
+
var WarpFastsetOutput = class {
|
|
1820
1821
|
constructor(config, chain2) {
|
|
1821
1822
|
this.config = config;
|
|
1822
1823
|
this.chain = chain2;
|
|
@@ -1830,7 +1831,7 @@ var WarpFastsetResults = class {
|
|
|
1830
1831
|
const rawValues = [transactionHash, blockNumber, timestamp];
|
|
1831
1832
|
const stringValues = rawValues.map((v) => String(v));
|
|
1832
1833
|
return {
|
|
1833
|
-
success,
|
|
1834
|
+
status: success ? "success" : "error",
|
|
1834
1835
|
warp,
|
|
1835
1836
|
action: 0,
|
|
1836
1837
|
user: getWarpWalletAddressFromConfig2(this.config, this.chain.name),
|
|
@@ -1838,16 +1839,16 @@ var WarpFastsetResults = class {
|
|
|
1838
1839
|
tx,
|
|
1839
1840
|
next: null,
|
|
1840
1841
|
values: { string: stringValues, native: rawValues },
|
|
1841
|
-
|
|
1842
|
+
output: {},
|
|
1842
1843
|
messages: {}
|
|
1843
1844
|
};
|
|
1844
1845
|
}
|
|
1845
|
-
async
|
|
1846
|
+
async extractQueryOutput(warp, typedValues, actionIndex, inputs) {
|
|
1846
1847
|
const stringValues = typedValues.map((t) => this.serializer.typedToString(t));
|
|
1847
1848
|
const nativeValues = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
|
|
1848
1849
|
const values = { string: stringValues, native: nativeValues };
|
|
1849
|
-
let
|
|
1850
|
-
if (!warp.
|
|
1850
|
+
let output = {};
|
|
1851
|
+
if (!warp.output) return { values, output };
|
|
1851
1852
|
const getNestedValue = (path) => {
|
|
1852
1853
|
const match = path.match(/^out\[(\d+)\]$/);
|
|
1853
1854
|
if (match) {
|
|
@@ -1863,25 +1864,25 @@ var WarpFastsetResults = class {
|
|
|
1863
1864
|
}
|
|
1864
1865
|
return value;
|
|
1865
1866
|
};
|
|
1866
|
-
for (const [key, path] of Object.entries(warp.
|
|
1867
|
+
for (const [key, path] of Object.entries(warp.output)) {
|
|
1867
1868
|
if (path.startsWith(WarpConstants.Transform.Prefix)) continue;
|
|
1868
|
-
const currentActionIndex =
|
|
1869
|
+
const currentActionIndex = parseOutputOutIndex(path);
|
|
1869
1870
|
if (currentActionIndex !== null && currentActionIndex !== actionIndex) {
|
|
1870
|
-
|
|
1871
|
+
output[key] = null;
|
|
1871
1872
|
continue;
|
|
1872
1873
|
}
|
|
1873
1874
|
if (path.startsWith("out.") || path === "out" || path.startsWith("out[")) {
|
|
1874
1875
|
const value = getNestedValue(path);
|
|
1875
|
-
|
|
1876
|
+
output[key] = value || null;
|
|
1876
1877
|
} else {
|
|
1877
|
-
|
|
1878
|
+
output[key] = path;
|
|
1878
1879
|
}
|
|
1879
1880
|
}
|
|
1880
1881
|
return {
|
|
1881
1882
|
values,
|
|
1882
|
-
|
|
1883
|
+
output: await evaluateOutputCommon(
|
|
1883
1884
|
warp,
|
|
1884
|
-
|
|
1885
|
+
output,
|
|
1885
1886
|
actionIndex,
|
|
1886
1887
|
inputs,
|
|
1887
1888
|
this.serializer.coreSerializer,
|
|
@@ -2900,7 +2901,7 @@ var WarpFastsetWallet = class {
|
|
|
2900
2901
|
}
|
|
2901
2902
|
async sendTransaction(tx) {
|
|
2902
2903
|
const { signature, ...transactionWithoutSignature } = tx;
|
|
2903
|
-
const _cert = await this.client.submitTransaction(transactionWithoutSignature, signature);
|
|
2904
|
+
const _cert = await this.client.submitTransaction(transactionWithoutSignature, signature ?? null);
|
|
2904
2905
|
return "TODO";
|
|
2905
2906
|
}
|
|
2906
2907
|
async sendTransactions(txs) {
|
|
@@ -2942,7 +2943,7 @@ function createFastsetAdapter(chainName, chainInfos) {
|
|
|
2942
2943
|
chainInfo,
|
|
2943
2944
|
builder: () => fallback.builder(),
|
|
2944
2945
|
executor: new WarpFastsetExecutor(config, chainInfo),
|
|
2945
|
-
|
|
2946
|
+
output: new WarpFastsetOutput(config, chainInfo),
|
|
2946
2947
|
serializer: new WarpFastsetSerializer(),
|
|
2947
2948
|
registry: fallback.registry,
|
|
2948
2949
|
explorer: new WarpFastsetExplorer(chainInfo, config),
|