@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.mjs
CHANGED
|
@@ -1615,7 +1615,8 @@ var WarpFastsetExecutor = class {
|
|
|
1615
1615
|
const senderPubKey = FastsetClient.decodeBech32Address(userWallet);
|
|
1616
1616
|
const recipientPubKey = FastsetClient.decodeBech32Address(executable.destination);
|
|
1617
1617
|
const nonce = await this.client.getNextNonce(userWallet);
|
|
1618
|
-
const
|
|
1618
|
+
const isSingleNativeTransfer = executable.transfers.length === 1 && executable.transfers[0].identifier === this.chain.nativeToken?.identifier;
|
|
1619
|
+
const nativeAmountInTransfers = isSingleNativeTransfer ? executable.transfers[0].amount : 0n;
|
|
1619
1620
|
const nativeAmountTotal = nativeAmountInTransfers + executable.value;
|
|
1620
1621
|
if (nativeAmountTotal > 0n) {
|
|
1621
1622
|
return {
|
|
@@ -1625,7 +1626,7 @@ var WarpFastsetExecutor = class {
|
|
|
1625
1626
|
timestamp_nanos: BigInt(Date.now()) * 1000000n,
|
|
1626
1627
|
claim: { Transfer: { amount: nativeAmountTotal.toString(16), user_data: null } }
|
|
1627
1628
|
};
|
|
1628
|
-
} else if (executable.transfers.length === 1
|
|
1629
|
+
} else if (executable.transfers.length === 1) {
|
|
1629
1630
|
return {
|
|
1630
1631
|
sender: senderPubKey,
|
|
1631
1632
|
recipient: { FastSet: recipientPubKey },
|
|
@@ -1805,6 +1806,8 @@ var WarpFastsetResults = class {
|
|
|
1805
1806
|
const transactionHash = this.extractTransactionHash(tx);
|
|
1806
1807
|
const blockNumber = this.extractBlockNumber(tx);
|
|
1807
1808
|
const timestamp = this.extractTimestamp(tx);
|
|
1809
|
+
const rawValues = [transactionHash, blockNumber, timestamp];
|
|
1810
|
+
const stringValues = rawValues.map((v) => String(v));
|
|
1808
1811
|
return {
|
|
1809
1812
|
success,
|
|
1810
1813
|
warp,
|
|
@@ -1813,26 +1816,26 @@ var WarpFastsetResults = class {
|
|
|
1813
1816
|
txHash: transactionHash,
|
|
1814
1817
|
tx,
|
|
1815
1818
|
next: null,
|
|
1816
|
-
values:
|
|
1817
|
-
valuesRaw: [transactionHash, blockNumber, timestamp],
|
|
1819
|
+
values: { string: stringValues, native: rawValues },
|
|
1818
1820
|
results: {},
|
|
1819
1821
|
messages: {}
|
|
1820
1822
|
};
|
|
1821
1823
|
}
|
|
1822
1824
|
async extractQueryResults(warp, typedValues, actionIndex, inputs) {
|
|
1823
|
-
const
|
|
1824
|
-
const
|
|
1825
|
+
const stringValues = typedValues.map((t) => this.serializer.typedToString(t));
|
|
1826
|
+
const nativeValues = typedValues.map((t) => this.serializer.typedToNative(t)[1]);
|
|
1827
|
+
const values = { string: stringValues, native: nativeValues };
|
|
1825
1828
|
let results = {};
|
|
1826
1829
|
if (!warp.results) return { values, results };
|
|
1827
1830
|
const getNestedValue = (path) => {
|
|
1828
1831
|
const match = path.match(/^out\[(\d+)\]$/);
|
|
1829
1832
|
if (match) {
|
|
1830
1833
|
const index = parseInt(match[1]) - 1;
|
|
1831
|
-
return
|
|
1834
|
+
return nativeValues[index];
|
|
1832
1835
|
}
|
|
1833
1836
|
const indices = path.split(".").slice(1).map((i) => parseInt(i) - 1);
|
|
1834
1837
|
if (indices.length === 0) return void 0;
|
|
1835
|
-
let value =
|
|
1838
|
+
let value = nativeValues[indices[0]];
|
|
1836
1839
|
for (let i = 1; i < indices.length; i++) {
|
|
1837
1840
|
if (value === void 0 || value === null) return void 0;
|
|
1838
1841
|
value = value[indices[i]];
|
|
@@ -1853,7 +1856,17 @@ var WarpFastsetResults = class {
|
|
|
1853
1856
|
results[key] = path;
|
|
1854
1857
|
}
|
|
1855
1858
|
}
|
|
1856
|
-
return {
|
|
1859
|
+
return {
|
|
1860
|
+
values,
|
|
1861
|
+
results: await evaluateResultsCommon(
|
|
1862
|
+
warp,
|
|
1863
|
+
results,
|
|
1864
|
+
actionIndex,
|
|
1865
|
+
inputs,
|
|
1866
|
+
this.serializer.coreSerializer,
|
|
1867
|
+
this.config.transform?.runner
|
|
1868
|
+
)
|
|
1869
|
+
};
|
|
1857
1870
|
}
|
|
1858
1871
|
isTransactionSuccessful(tx) {
|
|
1859
1872
|
if (!tx) return false;
|