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.browser.mjs
CHANGED
|
@@ -77638,10 +77638,17 @@ var TokenABI = abi.contract({
|
|
|
77638
77638
|
initialize: abi.opcode(0n).custom(async function(opcode, params) {
|
|
77639
77639
|
const parsed = paramSchema.safeParse(params.tokenParams);
|
|
77640
77640
|
if (!parsed.success) {
|
|
77641
|
-
return new BoxedError(
|
|
77641
|
+
return new BoxedError(
|
|
77642
|
+
"InvalidParams" /* InvalidParams */,
|
|
77643
|
+
`Invalid parameters: ${parsed.error.message}`
|
|
77644
|
+
);
|
|
77642
77645
|
}
|
|
77643
|
-
const nameEncoded = consumeOrThrow(
|
|
77644
|
-
|
|
77646
|
+
const nameEncoded = consumeOrThrow(
|
|
77647
|
+
new Encodable(parsed.data.name).encodeFrom("name")
|
|
77648
|
+
);
|
|
77649
|
+
const symbolEncoded = consumeOrThrow(
|
|
77650
|
+
new Encodable(parsed.data.symbol).encodeFrom("char")
|
|
77651
|
+
);
|
|
77645
77652
|
const premine = (parsed.data.premine ?? 0n) * 10n ** DECIMALS;
|
|
77646
77653
|
const valuePerMint = (parsed.data.valuePerMint ?? 0n) * 10n ** DECIMALS;
|
|
77647
77654
|
const callData = [
|
|
@@ -77653,7 +77660,13 @@ var TokenABI = abi.contract({
|
|
|
77653
77660
|
...nameEncoded,
|
|
77654
77661
|
...symbolEncoded
|
|
77655
77662
|
];
|
|
77656
|
-
const res = consumeOrThrow(
|
|
77663
|
+
const res = consumeOrThrow(
|
|
77664
|
+
await this.pushExecute({
|
|
77665
|
+
signPsbt: this.signPsbt,
|
|
77666
|
+
address: params.address,
|
|
77667
|
+
callData
|
|
77668
|
+
})
|
|
77669
|
+
);
|
|
77657
77670
|
return new BoxedSuccess(res);
|
|
77658
77671
|
}),
|
|
77659
77672
|
mintTokens: abi.opcode(77n).execute().returns("uint8Array"),
|
|
@@ -77666,19 +77679,20 @@ var TokenABI = abi.contract({
|
|
|
77666
77679
|
getData: abi.opcode(1000n).view().returns("uint8Array"),
|
|
77667
77680
|
getBalance: abi.opcode(1002n).custom(async function(opcode, address3) {
|
|
77668
77681
|
try {
|
|
77669
|
-
const
|
|
77670
|
-
await this.provider.rpc.
|
|
77671
|
-
).
|
|
77682
|
+
const balances = consumeOrThrow(
|
|
77683
|
+
await this.provider.rpc.espo.getAddressBalances(address3)
|
|
77684
|
+
).balances;
|
|
77672
77685
|
const target2 = `${this.alkaneId.block.toString()}:${this.alkaneId.tx.toString()}`;
|
|
77673
|
-
|
|
77674
|
-
|
|
77675
|
-
|
|
77676
|
-
)
|
|
77677
|
-
|
|
77678
|
-
}, 0n);
|
|
77679
|
-
return new BoxedSuccess(new DecodableAlkanesResponse(balance).decodeTo("tokenValue"));
|
|
77686
|
+
return new BoxedSuccess(
|
|
77687
|
+
new DecodableAlkanesResponse(BigInt(balances[target2]) ?? 0n).decodeTo(
|
|
77688
|
+
"tokenValue"
|
|
77689
|
+
)
|
|
77690
|
+
);
|
|
77680
77691
|
} catch (err) {
|
|
77681
|
-
return new BoxedError(
|
|
77692
|
+
return new BoxedError(
|
|
77693
|
+
"UnknownError" /* UnknownError */,
|
|
77694
|
+
`Failed to fetch balance: ${err.message}`
|
|
77695
|
+
);
|
|
77682
77696
|
}
|
|
77683
77697
|
})
|
|
77684
77698
|
});
|