@credenza3/contracts-lib-sui 0.1.6 → 0.1.8
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.
|
@@ -6384,17 +6384,15 @@ var CRED = class extends CredenzaSuiModule {
|
|
|
6384
6384
|
const tx = new import_transactions.Transaction();
|
|
6385
6385
|
let assetIdToSend;
|
|
6386
6386
|
if (assetBalance === amount) {
|
|
6387
|
-
assetIdToSend =
|
|
6387
|
+
assetIdToSend = asset.objectId;
|
|
6388
6388
|
} else {
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
typeArguments: [this.getCredType()]
|
|
6393
|
-
});
|
|
6389
|
+
const res = await this.split(asset.objectId, amount);
|
|
6390
|
+
assetIdToSend = (0, import_get.default)(res, "effects.created.0.reference.objectId");
|
|
6391
|
+
await this.client.suiClient.waitForTransaction({ digest: res.digest });
|
|
6394
6392
|
}
|
|
6395
6393
|
tx.moveCall({
|
|
6396
6394
|
target: `0x2::transfer::public_transfer`,
|
|
6397
|
-
arguments: [assetIdToSend, tx.pure.address(target)],
|
|
6395
|
+
arguments: [tx.object(assetIdToSend), tx.pure.address(target)],
|
|
6398
6396
|
typeArguments: [this.getCredCoinType()]
|
|
6399
6397
|
});
|
|
6400
6398
|
return this.client.signAndExecuteTransaction(tx);
|
|
@@ -6420,11 +6418,12 @@ var CRED = class extends CredenzaSuiModule {
|
|
|
6420
6418
|
}
|
|
6421
6419
|
async split(coinId, amount) {
|
|
6422
6420
|
const tx = new import_transactions.Transaction();
|
|
6423
|
-
tx.moveCall({
|
|
6421
|
+
const splitted = tx.moveCall({
|
|
6424
6422
|
target: `0x2::coin::split`,
|
|
6425
6423
|
arguments: [tx.object(coinId), tx.pure.u64(amount)],
|
|
6426
6424
|
typeArguments: [this.getCredType()]
|
|
6427
6425
|
});
|
|
6426
|
+
tx.transferObjects([splitted], this.client.getSignerAddress());
|
|
6428
6427
|
return this.client.signAndExecuteTransaction(tx);
|
|
6429
6428
|
}
|
|
6430
6429
|
};
|