alkanesjs 1.2.5 → 1.2.6
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.browser.mjs +29 -15
- package/dist/index.browser.mjs.map +2 -2
- package/dist/index.js +29 -15
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65535,10 +65535,17 @@ var TokenABI = abi.contract({
|
|
|
65535
65535
|
initialize: abi.opcode(0n).custom(async function(opcode, params) {
|
|
65536
65536
|
const parsed = paramSchema.safeParse(params.tokenParams);
|
|
65537
65537
|
if (!parsed.success) {
|
|
65538
|
-
return new BoxedError(
|
|
65538
|
+
return new BoxedError(
|
|
65539
|
+
"InvalidParams" /* InvalidParams */,
|
|
65540
|
+
`Invalid parameters: ${parsed.error.message}`
|
|
65541
|
+
);
|
|
65539
65542
|
}
|
|
65540
|
-
const nameEncoded = consumeOrThrow(
|
|
65541
|
-
|
|
65543
|
+
const nameEncoded = consumeOrThrow(
|
|
65544
|
+
new Encodable(parsed.data.name).encodeFrom("name")
|
|
65545
|
+
);
|
|
65546
|
+
const symbolEncoded = consumeOrThrow(
|
|
65547
|
+
new Encodable(parsed.data.symbol).encodeFrom("char")
|
|
65548
|
+
);
|
|
65542
65549
|
const premine = (parsed.data.premine ?? 0n) * 10n ** DECIMALS;
|
|
65543
65550
|
const valuePerMint = (parsed.data.valuePerMint ?? 0n) * 10n ** DECIMALS;
|
|
65544
65551
|
const callData = [
|
|
@@ -65550,7 +65557,13 @@ var TokenABI = abi.contract({
|
|
|
65550
65557
|
...nameEncoded,
|
|
65551
65558
|
...symbolEncoded
|
|
65552
65559
|
];
|
|
65553
|
-
const res = consumeOrThrow(
|
|
65560
|
+
const res = consumeOrThrow(
|
|
65561
|
+
await this.pushExecute({
|
|
65562
|
+
signPsbt: this.signPsbt,
|
|
65563
|
+
address: params.address,
|
|
65564
|
+
callData
|
|
65565
|
+
})
|
|
65566
|
+
);
|
|
65554
65567
|
return new BoxedSuccess(res);
|
|
65555
65568
|
}),
|
|
65556
65569
|
mintTokens: abi.opcode(77n).execute().returns("uint8Array"),
|
|
@@ -65563,19 +65576,20 @@ var TokenABI = abi.contract({
|
|
|
65563
65576
|
getData: abi.opcode(1000n).view().returns("uint8Array"),
|
|
65564
65577
|
getBalance: abi.opcode(1002n).custom(async function(opcode, address3) {
|
|
65565
65578
|
try {
|
|
65566
|
-
const
|
|
65567
|
-
await this.provider.rpc.
|
|
65568
|
-
).
|
|
65579
|
+
const balances = consumeOrThrow(
|
|
65580
|
+
await this.provider.rpc.espo.getAddressBalances(address3)
|
|
65581
|
+
).balances;
|
|
65569
65582
|
const target2 = `${this.alkaneId.block.toString()}:${this.alkaneId.tx.toString()}`;
|
|
65570
|
-
|
|
65571
|
-
|
|
65572
|
-
|
|
65573
|
-
)
|
|
65574
|
-
|
|
65575
|
-
}, 0n);
|
|
65576
|
-
return new BoxedSuccess(new DecodableAlkanesResponse(balance).decodeTo("tokenValue"));
|
|
65583
|
+
return new BoxedSuccess(
|
|
65584
|
+
new DecodableAlkanesResponse(BigInt(balances[target2]) ?? 0n).decodeTo(
|
|
65585
|
+
"tokenValue"
|
|
65586
|
+
)
|
|
65587
|
+
);
|
|
65577
65588
|
} catch (err) {
|
|
65578
|
-
return new BoxedError(
|
|
65589
|
+
return new BoxedError(
|
|
65590
|
+
"UnknownError" /* UnknownError */,
|
|
65591
|
+
`Failed to fetch balance: ${err.message}`
|
|
65592
|
+
);
|
|
65579
65593
|
}
|
|
65580
65594
|
})
|
|
65581
65595
|
});
|