@neuraiproject/neurai-assets 1.2.1 → 1.2.2
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/NeuraiAssets.global.js +19 -13
- package/dist/NeuraiAssets.global.js.map +1 -1
- package/dist/browser.js +19 -13
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +19 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -4376,23 +4376,27 @@ var NeuraiAssetsBundle = (function (exports) {
|
|
|
4376
4376
|
}
|
|
4377
4377
|
|
|
4378
4378
|
/**
|
|
4379
|
-
* Convert amount to
|
|
4380
|
-
*
|
|
4381
|
-
*
|
|
4382
|
-
*
|
|
4379
|
+
* Convert asset amount to protocol raw units.
|
|
4380
|
+
* Asset raw quantities in transaction payloads are always encoded with
|
|
4381
|
+
* 8 decimal places, regardless of the asset's displayed `units`.
|
|
4382
|
+
*
|
|
4383
|
+
* @param {number} amount - User-facing asset amount
|
|
4384
|
+
* @param {number} units - Asset decimal places (kept for API compatibility)
|
|
4385
|
+
* @returns {number} Amount in protocol raw units
|
|
4383
4386
|
*/
|
|
4384
4387
|
toSatoshis(amount, units) {
|
|
4385
|
-
return Math.round(amount *
|
|
4388
|
+
return Math.round(amount * 100000000);
|
|
4386
4389
|
}
|
|
4387
4390
|
|
|
4388
4391
|
/**
|
|
4389
|
-
* Convert
|
|
4390
|
-
*
|
|
4391
|
-
* @param {number}
|
|
4392
|
+
* Convert protocol raw units back to a user-facing asset amount.
|
|
4393
|
+
*
|
|
4394
|
+
* @param {number} satoshis - Amount in protocol raw units
|
|
4395
|
+
* @param {number} units - Asset decimal places (kept for API compatibility)
|
|
4392
4396
|
* @returns {number} Amount in asset units
|
|
4393
4397
|
*/
|
|
4394
4398
|
fromSatoshis(satoshis, units) {
|
|
4395
|
-
return satoshis /
|
|
4399
|
+
return satoshis / 100000000;
|
|
4396
4400
|
}
|
|
4397
4401
|
|
|
4398
4402
|
/**
|
|
@@ -5975,11 +5979,13 @@ var NeuraiAssetsBundle = (function (exports) {
|
|
|
5975
5979
|
// Last: Issue qualifier operation
|
|
5976
5980
|
const issueQualifierOutput = OutputFormatter.formatIssueQualifierOutput({
|
|
5977
5981
|
asset_name: assetName,
|
|
5978
|
-
asset_quantity: quantity,
|
|
5982
|
+
asset_quantity: this.toSatoshis(quantity, 0),
|
|
5979
5983
|
has_ipfs: hasIpfs,
|
|
5980
5984
|
ipfs_hash: ipfsHash,
|
|
5981
5985
|
root_change_address: isSub ? changeAddress : undefined,
|
|
5982
|
-
change_quantity: isSub
|
|
5986
|
+
change_quantity: isSub && parentQualifierQuantity !== null
|
|
5987
|
+
? this.toSatoshis(parentQualifierQuantity, 0)
|
|
5988
|
+
: undefined
|
|
5983
5989
|
});
|
|
5984
5990
|
|
|
5985
5991
|
outputs.push({ [toAddress]: issueQualifierOutput });
|
|
@@ -6741,12 +6747,12 @@ var NeuraiAssetsBundle = (function (exports) {
|
|
|
6741
6747
|
? OutputFormatter.formatUntagAddressesOutput({
|
|
6742
6748
|
qualifier: qualifierName,
|
|
6743
6749
|
addresses: targetAddresses,
|
|
6744
|
-
change_quantity: qualifierQuantity
|
|
6750
|
+
change_quantity: this.toSatoshis(qualifierQuantity, 0)
|
|
6745
6751
|
})
|
|
6746
6752
|
: OutputFormatter.formatTagAddressesOutput({
|
|
6747
6753
|
qualifier: qualifierName,
|
|
6748
6754
|
addresses: targetAddresses,
|
|
6749
|
-
change_quantity: qualifierQuantity
|
|
6755
|
+
change_quantity: this.toSatoshis(qualifierQuantity, 0)
|
|
6750
6756
|
});
|
|
6751
6757
|
|
|
6752
6758
|
outputs.push({ [changeAddress]: operationOutput });
|