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