@vleap/warps-adapter-fastset 0.1.0-alpha.29 → 0.1.0-alpha.30
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 +22 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1645,7 +1645,8 @@ var WarpFastsetExecutor = class {
|
|
|
1645
1645
|
const senderPubKey = FastsetClient.decodeBech32Address(userWallet);
|
|
1646
1646
|
const recipientPubKey = FastsetClient.decodeBech32Address(executable.destination);
|
|
1647
1647
|
const nonce = await this.client.getNextNonce(userWallet);
|
|
1648
|
-
const
|
|
1648
|
+
const isSingleNativeTransfer = executable.transfers.length === 1 && executable.transfers[0].identifier === this.chain.nativeToken?.identifier;
|
|
1649
|
+
const nativeAmountInTransfers = isSingleNativeTransfer ? executable.transfers[0].amount : 0n;
|
|
1649
1650
|
const nativeAmountTotal = nativeAmountInTransfers + executable.value;
|
|
1650
1651
|
if (nativeAmountTotal > 0n) {
|
|
1651
1652
|
return {
|
|
@@ -1655,7 +1656,7 @@ var WarpFastsetExecutor = class {
|
|
|
1655
1656
|
timestamp_nanos: BigInt(Date.now()) * 1000000n,
|
|
1656
1657
|
claim: { Transfer: { amount: nativeAmountTotal.toString(16), user_data: null } }
|
|
1657
1658
|
};
|
|
1658
|
-
} else if (executable.transfers.length === 1
|
|
1659
|
+
} else if (executable.transfers.length === 1) {
|
|
1659
1660
|
return {
|
|
1660
1661
|
sender: senderPubKey,
|
|
1661
1662
|
recipient: { FastSet: recipientPubKey },
|
|
@@ -1828,6 +1829,8 @@ var WarpFastsetResults = class {
|
|
|
1828
1829
|
const transactionHash = this.extractTransactionHash(tx);
|
|
1829
1830
|
const blockNumber = this.extractBlockNumber(tx);
|
|
1830
1831
|
const timestamp = this.extractTimestamp(tx);
|
|
1832
|
+
const rawValues = [transactionHash, blockNumber, timestamp];
|
|
1833
|
+
const stringValues = rawValues.map((v) => String(v));
|
|
1831
1834
|
return {
|
|
1832
1835
|
success,
|
|
1833
1836
|
warp,
|
|
@@ -1836,26 +1839,26 @@ var WarpFastsetResults = class {
|
|
|
1836
1839
|
txHash: transactionHash,
|
|
1837
1840
|
tx,
|
|
1838
1841
|
next: null,
|
|
1839
|
-
values:
|
|
1840
|
-
valuesRaw: [transactionHash, blockNumber, timestamp],
|
|
1842
|
+
values: { string: stringValues, native: rawValues },
|
|
1841
1843
|
results: {},
|
|
1842
1844
|
messages: {}
|
|
1843
1845
|
};
|
|
1844
1846
|
}
|
|
1845
1847
|
async extractQueryResults(warp, typedValues, actionIndex, inputs) {
|
|
1846
|
-
const
|
|
1847
|
-
const
|
|
1848
|
+
const stringValues = typedValues.map((t) => this.serializer.typedToString(t));
|
|
1849
|
+
const nativeValues = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
|
|
1850
|
+
const values = { string: stringValues, native: nativeValues };
|
|
1848
1851
|
let results = {};
|
|
1849
1852
|
if (!warp.results) return { values, results };
|
|
1850
1853
|
const getNestedValue = (path) => {
|
|
1851
1854
|
const match = path.match(/^out\[(\d+)\]$/);
|
|
1852
1855
|
if (match) {
|
|
1853
1856
|
const index = parseInt(match[1]) - 1;
|
|
1854
|
-
return
|
|
1857
|
+
return nativeValues[index];
|
|
1855
1858
|
}
|
|
1856
1859
|
const indices = path.split(".").slice(1).map((i) => parseInt(i) - 1);
|
|
1857
1860
|
if (indices.length === 0) return void 0;
|
|
1858
|
-
let value =
|
|
1861
|
+
let value = nativeValues[indices[0]];
|
|
1859
1862
|
for (let i = 1; i < indices.length; i++) {
|
|
1860
1863
|
if (value === void 0 || value === null) return void 0;
|
|
1861
1864
|
value = value[indices[i]];
|
|
@@ -1876,7 +1879,17 @@ var WarpFastsetResults = class {
|
|
|
1876
1879
|
results[key] = path;
|
|
1877
1880
|
}
|
|
1878
1881
|
}
|
|
1879
|
-
return {
|
|
1882
|
+
return {
|
|
1883
|
+
values,
|
|
1884
|
+
results: await (0, import_warps4.evaluateResultsCommon)(
|
|
1885
|
+
warp,
|
|
1886
|
+
results,
|
|
1887
|
+
actionIndex,
|
|
1888
|
+
inputs,
|
|
1889
|
+
this.serializer.coreSerializer,
|
|
1890
|
+
this.config.transform?.runner
|
|
1891
|
+
)
|
|
1892
|
+
};
|
|
1880
1893
|
}
|
|
1881
1894
|
isTransactionSuccessful(tx) {
|
|
1882
1895
|
if (!tx) return false;
|