Comparing version 0.0.13 to 0.0.14
@@ -82,4 +82,4 @@ const sui = require('@mysten/sui.js'); | ||
for (let param of params) { | ||
if (param.indexOf && param.indexOf('<SUI>') === 0) { | ||
let amount = BigInt(param.split('>')[1]); | ||
if (param && param.type && param.amount && param.type === 'SUI') { | ||
let amount = BigInt(param.amount); | ||
const coin = tx.add(sui.Transactions.SplitCoins(tx.gas, [tx.pure(amount)])); | ||
@@ -86,0 +86,0 @@ callArgs.push(coin); |
{ | ||
"name": "suidouble", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Set of provider, package and object classes for javascript representation of Sui Move smart contracts. Use same code for publishing, upgrading, integration testing, interaction with smart contracts and integration in browser web3 dapps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -158,6 +158,8 @@ # suidouble | ||
If you need to transfer some SUI as part of executing contract method, you can use a magic parameter in form of '<SUI>400000000000' where 400000000000 is the amount of MIST you want to send. SuiPackageModule will convert this amount to Coin object using Transactions.SplitCoins method. | ||
If you need to transfer some SUI as part of executing contract method, you can use a magic parameter in form of {type: 'SUI', amount: 400000000000n} where 400000000000 is the amount of MIST you want to send. SuiPackageModule will convert this amount to Coin object using Transactions.SplitCoins method. | ||
`amount: 400000000000n`, `amount: '400000000000'`, `amount: 400000000000` will work too | ||
```javascript | ||
const moveCallResult = await contract.moveCall('suidouble_chat', 'post_pay', [chatShopObjectId, '<SUI>400000000000', messageText, 'metadata']); | ||
const moveCallResult = await contract.moveCall('suidouble_chat', 'post_pay', [chatShopObjectId, {type: 'SUI', amount: 400000000000n}, messageText, 'metadata']); | ||
``` | ||
@@ -164,0 +166,0 @@ |
@@ -258,3 +258,3 @@ 'use strict' | ||
// but can post with with post_pay function sending some sui to it | ||
const moveCallResult = await contract.moveCall('suidouble_chat', 'post_pay', [chatShopObjectId, '<SUI>400000000000', longMessageYouCanNotPostForFree, 'metadata']); | ||
const moveCallResult = await contract.moveCall('suidouble_chat', 'post_pay', [chatShopObjectId, {type: 'SUI', amount: 400000000000n}, longMessageYouCanNotPostForFree, 'metadata']); | ||
@@ -261,0 +261,0 @@ // there're at least some object created |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158786
313