@mysten/kiosk
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -323,2 +323,3 @@ "use strict"; | ||
// src/tx/kiosk.ts | ||
var import_bcs3 = require("@mysten/sui.js/bcs"); | ||
function createKiosk(tx) { | ||
@@ -360,3 +361,3 @@ const [kiosk, kioskOwnerCap] = tx.moveCall({ | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)] | ||
}); | ||
@@ -372,4 +373,4 @@ return item; | ||
objArg(tx, kioskCap), | ||
tx.pure(itemId, "address"), | ||
tx.pure(price, "u64") | ||
tx.pure.address(itemId), | ||
tx.pure.u64(price) | ||
] | ||
@@ -382,3 +383,3 @@ }); | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)] | ||
}); | ||
@@ -390,3 +391,3 @@ } | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure(price, "u64")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure.u64(price)] | ||
}); | ||
@@ -398,3 +399,3 @@ } | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), tx.pure(itemId, "address"), objArg(tx, payment)] | ||
arguments: [objArg(tx, kiosk), tx.pure.address(itemId), objArg(tx, payment)] | ||
}); | ||
@@ -404,3 +405,3 @@ return [item, transferRequest]; | ||
function withdrawFromKiosk(tx, kiosk, kioskCap, amount) { | ||
const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, "Option<u64>"); | ||
const amountArg = import_bcs3.bcs.option(import_bcs3.bcs.u64()).serialize(amount); | ||
const [coin] = tx.moveCall({ | ||
@@ -416,3 +417,3 @@ target: `${KIOSK_MODULE}::withdraw`, | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)] | ||
}); | ||
@@ -807,4 +808,4 @@ return [item, promise]; | ||
objArg(tx, policyCap), | ||
tx.pure(percentageBps, "u16"), | ||
tx.pure(minAmount, "u64") | ||
tx.pure.u16(Number(percentageBps)), | ||
tx.pure.u64(minAmount) | ||
] | ||
@@ -824,3 +825,3 @@ }); | ||
typeArguments: [type], | ||
arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure(minPrice, "u64")] | ||
arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure.u64(minPrice)] | ||
}); | ||
@@ -830,2 +831,3 @@ } | ||
// src/tx/transfer-policy.ts | ||
var import_bcs5 = require("@mysten/sui.js/bcs"); | ||
function createTransferPolicy(tx, itemType, publisher) { | ||
@@ -856,3 +858,3 @@ const [transferPolicy, transferPolicyCap] = createTransferPolicyWithoutSharing( | ||
function withdrawFromPolicy(tx, itemType, policy, policyCap, amount) { | ||
const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, "Option<u64>"); | ||
const amountArg = import_bcs5.bcs.option(import_bcs5.bcs.u64()).serialize(amount); | ||
const [profits] = tx.moveCall({ | ||
@@ -919,3 +921,3 @@ target: `${TRANSFER_POLICY_MODULE}::withdraw`, | ||
const cap = createTransferPolicy(this.transactionBlock, type, publisher); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address)); | ||
} | ||
@@ -960,3 +962,3 @@ /** | ||
[this.policyCap], | ||
this.transactionBlock.pure(address, "address") | ||
this.transactionBlock.pure.address(address) | ||
); | ||
@@ -986,3 +988,3 @@ } | ||
); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -1255,3 +1257,3 @@ } | ||
const cap = createKioskAndShare(this.transactionBlock); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address)); | ||
} | ||
@@ -1277,3 +1279,3 @@ /** | ||
[this.kioskCap], | ||
this.transactionBlock.pure(address, "address") | ||
this.transactionBlock.pure.address(address) | ||
); | ||
@@ -1336,3 +1338,3 @@ } | ||
); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -1402,3 +1404,3 @@ } | ||
const item = this.take({ itemType, itemId }); | ||
this.transactionBlock.transferObjects([item], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([item], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -1434,3 +1436,3 @@ } | ||
const coin = this.transactionBlock.splitCoins(this.transactionBlock.gas, [ | ||
this.transactionBlock.pure(price, "u64") | ||
this.transactionBlock.pure.u64(price) | ||
]); | ||
@@ -1437,0 +1439,0 @@ return purchase(this.transactionBlock, itemType, sellerKiosk, itemId, coin); |
# @mysten/kiosk | ||
## 0.7.1 | ||
### Patch Changes | ||
- Updated dependencies [781d073d9] | ||
- Updated dependencies [3764c464f] | ||
- Updated dependencies [e4484852b] | ||
- Updated dependencies [71e0a3197] | ||
- Updated dependencies [1bc430161] | ||
- @mysten/sui.js@0.43.0 | ||
## 0.7.0 | ||
@@ -4,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { type TransactionArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionObjectArgument, type TransactionArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { ItemId, ItemReference, ItemValue, KioskOwnerCap, ObjectArgument, Price, PurchaseOptions } from '../types'; | ||
@@ -25,4 +25,4 @@ import { type KioskClient } from './kiosk-client'; | ||
kioskClient: KioskClient; | ||
kiosk?: TransactionArgument; | ||
kioskCap?: TransactionArgument; | ||
kiosk?: TransactionObjectArgument; | ||
kioskCap?: TransactionObjectArgument; | ||
constructor({ transactionBlock, kioskClient, cap }: KioskTransactionParams); | ||
@@ -118,3 +118,3 @@ /** | ||
*/ | ||
take({ itemType, itemId }: ItemId): TransactionArgument; | ||
take({ itemType, itemId }: ItemId): TransactionObjectArgument; | ||
/** | ||
@@ -151,3 +151,6 @@ * Transfer a non-locked/non-listed item to an address. | ||
sellerKiosk: ObjectArgument; | ||
}): [TransactionArgument, TransactionArgument]; | ||
}): [ | ||
TransactionObjectArgument, | ||
TransactionObjectArgument | ||
]; | ||
/** | ||
@@ -178,34 +181,6 @@ * A function to purchase and resolve a transfer policy. | ||
finalize(): void; | ||
setKioskCap(cap: TransactionArgument): this; | ||
setKiosk(kiosk: TransactionArgument): this; | ||
getKiosk(): { | ||
kind: "Input"; | ||
index: number; | ||
type?: "object" | "pure" | undefined; | ||
value?: any; | ||
} | { | ||
kind: "GasCoin"; | ||
} | { | ||
kind: "Result"; | ||
index: number; | ||
} | { | ||
kind: "NestedResult"; | ||
index: number; | ||
resultIndex: number; | ||
}; | ||
getKioskCap(): { | ||
kind: "Input"; | ||
index: number; | ||
type?: "object" | "pure" | undefined; | ||
value?: any; | ||
} | { | ||
kind: "GasCoin"; | ||
} | { | ||
kind: "Result"; | ||
index: number; | ||
} | { | ||
kind: "NestedResult"; | ||
index: number; | ||
resultIndex: number; | ||
}; | ||
setKioskCap(cap: TransactionObjectArgument): this; | ||
setKiosk(kiosk: TransactionObjectArgument): this; | ||
getKiosk(): TransactionObjectArgument; | ||
getKioskCap(): TransactionObjectArgument; | ||
} |
@@ -323,2 +323,3 @@ "use strict"; | ||
// src/tx/kiosk.ts | ||
var import_bcs3 = require("@mysten/sui.js/bcs"); | ||
function createKiosk(tx) { | ||
@@ -360,3 +361,3 @@ const [kiosk, kioskOwnerCap] = tx.moveCall({ | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)] | ||
}); | ||
@@ -372,4 +373,4 @@ return item; | ||
objArg(tx, kioskCap), | ||
tx.pure(itemId, "address"), | ||
tx.pure(price, "u64") | ||
tx.pure.address(itemId), | ||
tx.pure.u64(price) | ||
] | ||
@@ -382,3 +383,3 @@ }); | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)] | ||
}); | ||
@@ -390,3 +391,3 @@ } | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure(price, "u64")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure.u64(price)] | ||
}); | ||
@@ -398,3 +399,3 @@ } | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), tx.pure(itemId, "address"), objArg(tx, payment)] | ||
arguments: [objArg(tx, kiosk), tx.pure.address(itemId), objArg(tx, payment)] | ||
}); | ||
@@ -404,3 +405,3 @@ return [item, transferRequest]; | ||
function withdrawFromKiosk(tx, kiosk, kioskCap, amount) { | ||
const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, "Option<u64>"); | ||
const amountArg = import_bcs3.bcs.option(import_bcs3.bcs.u64()).serialize(amount); | ||
const [coin] = tx.moveCall({ | ||
@@ -416,3 +417,3 @@ target: `${KIOSK_MODULE}::withdraw`, | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, "address")] | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)] | ||
}); | ||
@@ -807,4 +808,4 @@ return [item, promise]; | ||
objArg(tx, policyCap), | ||
tx.pure(percentageBps, "u16"), | ||
tx.pure(minAmount, "u64") | ||
tx.pure.u16(Number(percentageBps)), | ||
tx.pure.u64(minAmount) | ||
] | ||
@@ -824,3 +825,3 @@ }); | ||
typeArguments: [type], | ||
arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure(minPrice, "u64")] | ||
arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure.u64(minPrice)] | ||
}); | ||
@@ -830,2 +831,3 @@ } | ||
// src/tx/transfer-policy.ts | ||
var import_bcs5 = require("@mysten/sui.js/bcs"); | ||
function createTransferPolicy(tx, itemType, publisher) { | ||
@@ -856,3 +858,3 @@ const [transferPolicy, transferPolicyCap] = createTransferPolicyWithoutSharing( | ||
function withdrawFromPolicy(tx, itemType, policy, policyCap, amount) { | ||
const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, "Option<u64>"); | ||
const amountArg = import_bcs5.bcs.option(import_bcs5.bcs.u64()).serialize(amount); | ||
const [profits] = tx.moveCall({ | ||
@@ -919,3 +921,3 @@ target: `${TRANSFER_POLICY_MODULE}::withdraw`, | ||
const cap = createTransferPolicy(this.transactionBlock, type, publisher); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address)); | ||
} | ||
@@ -960,3 +962,3 @@ /** | ||
[this.policyCap], | ||
this.transactionBlock.pure(address, "address") | ||
this.transactionBlock.pure.address(address) | ||
); | ||
@@ -986,3 +988,3 @@ } | ||
); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -1255,3 +1257,3 @@ } | ||
const cap = createKioskAndShare(this.transactionBlock); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address)); | ||
} | ||
@@ -1277,3 +1279,3 @@ /** | ||
[this.kioskCap], | ||
this.transactionBlock.pure(address, "address") | ||
this.transactionBlock.pure.address(address) | ||
); | ||
@@ -1336,3 +1338,3 @@ } | ||
); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -1402,3 +1404,3 @@ } | ||
const item = this.take({ itemType, itemId }); | ||
this.transactionBlock.transferObjects([item], this.transactionBlock.pure(address, "address")); | ||
this.transactionBlock.transferObjects([item], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -1434,3 +1436,3 @@ } | ||
const coin = this.transactionBlock.splitCoins(this.transactionBlock.gas, [ | ||
this.transactionBlock.pure(price, "u64") | ||
this.transactionBlock.pure.u64(price) | ||
]); | ||
@@ -1437,0 +1439,0 @@ return purchase(this.transactionBlock, itemType, sellerKiosk, itemId, coin); |
@@ -1,2 +0,2 @@ | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionArgument, TransactionBlock, TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
import { ObjectArgument } from '../types'; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare function createKiosk(tx: TransactionBlock): [TransactionArgument, TransactionArgument]; | ||
export declare function createKiosk(tx: TransactionBlock): [TransactionObjectArgument, TransactionObjectArgument]; | ||
/** | ||
@@ -12,3 +12,3 @@ * Calls the `kiosk::new()` function and shares the kiosk. | ||
*/ | ||
export declare function createKioskAndShare(tx: TransactionBlock): TransactionArgument; | ||
export declare function createKioskAndShare(tx: TransactionBlock): TransactionObjectArgument; | ||
/** | ||
@@ -36,3 +36,3 @@ * Converts Transfer Policy to a shared object. | ||
*/ | ||
export declare function take(tx: TransactionBlock, itemType: string, kiosk: ObjectArgument, kioskCap: ObjectArgument, itemId: string): TransactionArgument; | ||
export declare function take(tx: TransactionBlock, itemType: string, kiosk: ObjectArgument, kioskCap: ObjectArgument, itemId: string): TransactionObjectArgument; | ||
/** | ||
@@ -57,3 +57,3 @@ * Call the `kiosk::list<T>(Kiosk, KioskOwnerCap, ID, u64)` function. | ||
*/ | ||
export declare function purchase(tx: TransactionBlock, itemType: string, kiosk: ObjectArgument, itemId: string, payment: ObjectArgument): [TransactionArgument, TransactionArgument]; | ||
export declare function purchase(tx: TransactionBlock, itemType: string, kiosk: ObjectArgument, itemId: string, payment: ObjectArgument): [TransactionObjectArgument, TransactionObjectArgument]; | ||
/** | ||
@@ -63,3 +63,3 @@ * Call the `kiosk::withdraw(Kiosk, KioskOwnerCap, Option<u64>)` function and receive a Coin<SUI>. | ||
*/ | ||
export declare function withdrawFromKiosk(tx: TransactionBlock, kiosk: ObjectArgument, kioskCap: ObjectArgument, amount?: string | bigint | number): TransactionArgument; | ||
export declare function withdrawFromKiosk(tx: TransactionBlock, kiosk: ObjectArgument, kioskCap: ObjectArgument, amount?: string | bigint | number): TransactionObjectArgument; | ||
/** | ||
@@ -66,0 +66,0 @@ * Call the `kiosk::borrow_value<T>(Kiosk, KioskOwnerCap, ID): T` function. |
@@ -1,7 +0,7 @@ | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionBlock, TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
import { ObjectArgument } from '../types'; | ||
export declare function convertToPersonalTx(tx: TransactionBlock, kiosk: ObjectArgument, kioskOwnerCap: ObjectArgument, packageId: string): TransactionArgument; | ||
export declare function convertToPersonalTx(tx: TransactionBlock, kiosk: ObjectArgument, kioskOwnerCap: ObjectArgument, packageId: string): TransactionObjectArgument; | ||
/** | ||
* Transfers the personal kiosk Cap to the sender. | ||
*/ | ||
export declare function transferPersonalCapTx(tx: TransactionBlock, personalKioskCap: TransactionArgument, packageId: string): void; | ||
export declare function transferPersonalCapTx(tx: TransactionBlock, personalKioskCap: TransactionObjectArgument, packageId: string): void; |
@@ -1,2 +0,2 @@ | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionArgument, TransactionBlock, TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
import { ObjectArgument } from '../types'; | ||
@@ -7,3 +7,3 @@ /** | ||
*/ | ||
export declare function createTransferPolicy(tx: TransactionBlock, itemType: string, publisher: ObjectArgument): TransactionArgument; | ||
export declare function createTransferPolicy(tx: TransactionBlock, itemType: string, publisher: ObjectArgument): TransactionObjectArgument; | ||
/** | ||
@@ -13,11 +13,11 @@ * Creates a transfer Policy and returns both the Policy and the Cap. | ||
*/ | ||
export declare function createTransferPolicyWithoutSharing(tx: TransactionBlock, itemType: string, publisher: ObjectArgument): [TransactionArgument, TransactionArgument]; | ||
export declare function createTransferPolicyWithoutSharing(tx: TransactionBlock, itemType: string, publisher: ObjectArgument): [TransactionObjectArgument, TransactionObjectArgument]; | ||
/** | ||
* Converts Transfer Policy to a shared object. | ||
*/ | ||
export declare function shareTransferPolicy(tx: TransactionBlock, itemType: string, transferPolicy: TransactionArgument): void; | ||
export declare function shareTransferPolicy(tx: TransactionBlock, itemType: string, transferPolicy: TransactionObjectArgument): void; | ||
/** | ||
* Call the `transfer_policy::withdraw` function to withdraw profits from a transfer policy. | ||
*/ | ||
export declare function withdrawFromPolicy(tx: TransactionBlock, itemType: string, policy: ObjectArgument, policyCap: ObjectArgument, amount?: string | bigint | null): TransactionArgument; | ||
export declare function withdrawFromPolicy(tx: TransactionBlock, itemType: string, policy: ObjectArgument, policyCap: ObjectArgument, amount?: string | bigint | null): TransactionObjectArgument; | ||
/** | ||
@@ -24,0 +24,0 @@ * Call the `transfer_policy::confirm_request` function to unblock the |
import { type SharedObjectRef } from '@mysten/sui.js/bcs'; | ||
import { type SuiClient, type SuiObjectRef } from '@mysten/sui.js/client'; | ||
import { type TransactionArgument } from '@mysten/sui.js/transactions'; | ||
import { TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
import { BaseRulePackageIds } from '../constants'; | ||
@@ -10,3 +10,3 @@ export * from './kiosk'; | ||
*/ | ||
export type ObjectArgument = string | TransactionArgument | SharedObjectRef | SuiObjectRef; | ||
export type ObjectArgument = string | TransactionObjectArgument | SharedObjectRef | SuiObjectRef; | ||
/** | ||
@@ -13,0 +13,0 @@ * A Network selector. |
import { type ObjectOwner } from '@mysten/sui.js/client'; | ||
import { TransactionArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionObjectArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { ObjectArgument } from '.'; | ||
@@ -45,6 +45,6 @@ /** The Transfer Policy module. */ | ||
kioskCap: ObjectArgument; | ||
transferRequest: TransactionArgument; | ||
purchasedItem: TransactionArgument; | ||
transferRequest: TransactionObjectArgument; | ||
purchasedItem: TransactionObjectArgument; | ||
packageId: string; | ||
extraArgs: Record<string, any>; | ||
}; |
import { SharedObjectRef } from '@mysten/sui.js/bcs'; | ||
import { PaginationArguments, SuiClient, SuiObjectData, SuiObjectDataFilter, SuiObjectDataOptions, SuiObjectRef, SuiObjectResponse, type DynamicFieldInfo } from '@mysten/sui.js/client'; | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionBlock, TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
import { Kiosk, KioskData, KioskListing, TransferPolicyCap } from './types'; | ||
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export declare function objArg(txb: TransactionBlock, arg: string | SharedObjectRef | SuiObjectRef | TransactionArgument): TransactionArgument; | ||
export declare function objArg(txb: TransactionBlock, arg: string | SharedObjectRef | SuiObjectRef | TransactionObjectArgument): TransactionObjectArgument; | ||
export declare function getKioskObject(client: SuiClient, id: string): Promise<Kiosk>; | ||
@@ -15,0 +15,0 @@ export declare function extractKioskData(data: DynamicFieldInfo[], listings: KioskListing[], lockedItemIds: string[], kioskId: string): KioskData; |
@@ -5,3 +5,3 @@ { | ||
"description": "Sui Kiosk library", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"license": "Apache-2.0", | ||
@@ -28,3 +28,3 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@mysten/sui.js": "0.42.0" | ||
"@mysten/sui.js": "0.43.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { type TransactionArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { | ||
TransactionObjectArgument, | ||
type TransactionArgument, | ||
type TransactionBlock, | ||
} from '@mysten/sui.js/transactions'; | ||
@@ -42,4 +46,4 @@ import * as kioskTx from '../tx/kiosk'; | ||
kioskClient: KioskClient; | ||
kiosk?: TransactionArgument; | ||
kioskCap?: TransactionArgument; | ||
kiosk?: TransactionObjectArgument; | ||
kioskCap?: TransactionObjectArgument; | ||
// If we're pending `share` of a new kiosk, `finalize()` will share it. | ||
@@ -52,3 +56,3 @@ #pendingShare?: boolean; | ||
// The personal kiosk argument. | ||
#personalCap?: TransactionArgument; | ||
#personalCap?: TransactionObjectArgument; | ||
// A flag that checks whether kiosk TX is finalized. | ||
@@ -119,3 +123,3 @@ #finalized: boolean = false; | ||
const cap = kioskTx.createKioskAndShare(this.transactionBlock); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, 'address')); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address)); | ||
} | ||
@@ -143,3 +147,3 @@ | ||
[this.kioskCap!], | ||
this.transactionBlock.pure(address, 'address'), | ||
this.transactionBlock.pure.address(address), | ||
); | ||
@@ -209,3 +213,3 @@ } | ||
); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, 'address')); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -266,3 +270,3 @@ } | ||
*/ | ||
take({ itemType, itemId }: ItemId): TransactionArgument { | ||
take({ itemType, itemId }: ItemId): TransactionObjectArgument { | ||
this.#validateKioskIsSet(); | ||
@@ -282,3 +286,3 @@ return kioskTx.take(this.transactionBlock, itemType, this.kiosk!, this.kioskCap!, itemId); | ||
const item = this.take({ itemType, itemId }); | ||
this.transactionBlock.transferObjects([item], this.transactionBlock.pure(address, 'address')); | ||
this.transactionBlock.transferObjects([item], this.transactionBlock.pure.address(address)); | ||
return this; | ||
@@ -314,6 +318,9 @@ } | ||
sellerKiosk, | ||
}: ItemId & Price & { sellerKiosk: ObjectArgument }): [TransactionArgument, TransactionArgument] { | ||
}: ItemId & Price & { sellerKiosk: ObjectArgument }): [ | ||
TransactionObjectArgument, | ||
TransactionObjectArgument, | ||
] { | ||
// Split the coin for the amount of the listing. | ||
const coin = this.transactionBlock.splitCoins(this.transactionBlock.gas, [ | ||
this.transactionBlock.pure(price, 'u64'), | ||
this.transactionBlock.pure.u64(price), | ||
]); | ||
@@ -452,3 +459,3 @@ return kioskTx.purchase(this.transactionBlock, itemType, sellerKiosk, itemId, coin); | ||
// Some setters in case we want custom behavior. | ||
setKioskCap(cap: TransactionArgument) { | ||
setKioskCap(cap: TransactionObjectArgument) { | ||
this.#validateFinalizedStatus(); | ||
@@ -459,3 +466,3 @@ this.kioskCap = cap; | ||
setKiosk(kiosk: TransactionArgument) { | ||
setKiosk(kiosk: TransactionObjectArgument) { | ||
this.#validateFinalizedStatus(); | ||
@@ -462,0 +469,0 @@ this.kiosk = kiosk; |
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { TransactionArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionObjectArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
@@ -72,3 +72,3 @@ import { | ||
const cap = createTransferPolicy(this.transactionBlock, type, publisher); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure(address, 'address')); | ||
this.transactionBlock.transferObjects([cap], this.transactionBlock.pure.address(address)); | ||
} | ||
@@ -113,6 +113,6 @@ | ||
shareTransferPolicy(this.transactionBlock, this.type, this.policy as TransactionArgument); | ||
shareTransferPolicy(this.transactionBlock, this.type, this.policy as TransactionObjectArgument); | ||
this.transactionBlock.transferObjects( | ||
[this.policyCap as TransactionArgument], | ||
this.transactionBlock.pure(address, 'address'), | ||
[this.policyCap as TransactionObjectArgument], | ||
this.transactionBlock.pure.address(address), | ||
); | ||
@@ -146,3 +146,3 @@ } | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure(address, 'address')); | ||
this.transactionBlock.transferObjects([coin], this.transactionBlock.pure.address(address)); | ||
@@ -149,0 +149,0 @@ return this; |
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { bcs } from '@mysten/sui.js/bcs'; | ||
import { | ||
TransactionArgument, | ||
TransactionBlock, | ||
TransactionObjectArgument, | ||
} from '@mysten/sui.js/transactions'; | ||
@@ -12,3 +17,5 @@ import { KIOSK_MODULE, KIOSK_TYPE, ObjectArgument } from '../types'; | ||
*/ | ||
export function createKiosk(tx: TransactionBlock): [TransactionArgument, TransactionArgument] { | ||
export function createKiosk( | ||
tx: TransactionBlock, | ||
): [TransactionObjectArgument, TransactionObjectArgument] { | ||
const [kiosk, kioskOwnerCap] = tx.moveCall({ | ||
@@ -25,3 +32,3 @@ target: `${KIOSK_MODULE}::new`, | ||
*/ | ||
export function createKioskAndShare(tx: TransactionBlock): TransactionArgument { | ||
export function createKioskAndShare(tx: TransactionBlock): TransactionObjectArgument { | ||
const [kiosk, kioskOwnerCap] = createKiosk(tx); | ||
@@ -94,7 +101,7 @@ shareKiosk(tx, kiosk); | ||
itemId: string, | ||
): TransactionArgument { | ||
): TransactionObjectArgument { | ||
const [item] = tx.moveCall({ | ||
target: `${KIOSK_MODULE}::take`, | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, 'address')], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)], | ||
}); | ||
@@ -123,4 +130,4 @@ | ||
objArg(tx, kioskCap), | ||
tx.pure(itemId, 'address'), | ||
tx.pure(price, 'u64'), | ||
tx.pure.address(itemId), | ||
tx.pure.u64(price), | ||
], | ||
@@ -144,3 +151,3 @@ }); | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, 'address')], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)], | ||
}); | ||
@@ -164,3 +171,3 @@ } | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure(price, 'u64')], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), objArg(tx, item), tx.pure.u64(price)], | ||
}); | ||
@@ -179,7 +186,7 @@ } | ||
payment: ObjectArgument, | ||
): [TransactionArgument, TransactionArgument] { | ||
): [TransactionObjectArgument, TransactionObjectArgument] { | ||
const [item, transferRequest] = tx.moveCall({ | ||
target: `${KIOSK_MODULE}::purchase`, | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), tx.pure(itemId, 'address'), objArg(tx, payment)], | ||
arguments: [objArg(tx, kiosk), tx.pure.address(itemId), objArg(tx, payment)], | ||
}); | ||
@@ -199,4 +206,4 @@ | ||
amount?: string | bigint | number, | ||
): TransactionArgument { | ||
const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, 'Option<u64>'); | ||
): TransactionObjectArgument { | ||
const amountArg = bcs.option(bcs.u64()).serialize(amount); | ||
@@ -227,3 +234,3 @@ const [coin] = tx.moveCall({ | ||
typeArguments: [itemType], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure(itemId, 'address')], | ||
arguments: [objArg(tx, kiosk), objArg(tx, kioskCap), tx.pure.address(itemId)], | ||
}); | ||
@@ -230,0 +237,0 @@ |
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionBlock, TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
@@ -14,3 +14,3 @@ import { ObjectArgument } from '../types'; | ||
packageId: string, | ||
): TransactionArgument { | ||
): TransactionObjectArgument { | ||
const personalKioskCap = tx.moveCall({ | ||
@@ -29,3 +29,3 @@ target: `${packageId}::personal_kiosk::new`, | ||
tx: TransactionBlock, | ||
personalKioskCap: TransactionArgument, | ||
personalKioskCap: TransactionObjectArgument, | ||
packageId: string, | ||
@@ -32,0 +32,0 @@ ) { |
@@ -41,4 +41,4 @@ // Copyright (c) Mysten Labs, Inc. | ||
objArg(tx, policyCap), | ||
tx.pure(percentageBps, 'u16'), | ||
tx.pure(minAmount, 'u64'), | ||
tx.pure.u16(Number(percentageBps)), | ||
tx.pure.u64(minAmount), | ||
], | ||
@@ -73,4 +73,4 @@ }); | ||
typeArguments: [type], | ||
arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure(minPrice, 'u64')], | ||
arguments: [objArg(tx, policy), objArg(tx, policyCap), tx.pure.u64(minPrice)], | ||
}); | ||
} |
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { bcs } from '@mysten/sui.js/bcs'; | ||
import { | ||
TransactionArgument, | ||
TransactionBlock, | ||
TransactionObjectArgument, | ||
} from '@mysten/sui.js/transactions'; | ||
@@ -17,3 +22,3 @@ import { ObjectArgument, TRANSFER_POLICY_MODULE, TRANSFER_POLICY_TYPE } from '../types'; | ||
publisher: ObjectArgument, | ||
): TransactionArgument { | ||
): TransactionObjectArgument { | ||
const [transferPolicy, transferPolicyCap] = createTransferPolicyWithoutSharing( | ||
@@ -38,3 +43,3 @@ tx, | ||
publisher: ObjectArgument, | ||
): [TransactionArgument, TransactionArgument] { | ||
): [TransactionObjectArgument, TransactionObjectArgument] { | ||
const [transferPolicy, transferPolicyCap] = tx.moveCall({ | ||
@@ -54,3 +59,3 @@ target: `${TRANSFER_POLICY_MODULE}::new`, | ||
itemType: string, | ||
transferPolicy: TransactionArgument, | ||
transferPolicy: TransactionObjectArgument, | ||
) { | ||
@@ -73,4 +78,4 @@ tx.moveCall({ | ||
amount?: string | bigint | null, | ||
): TransactionArgument { | ||
const amountArg = tx.pure(amount ? { Some: amount } : { None: true }, 'Option<u64>'); | ||
): TransactionObjectArgument { | ||
const amountArg = bcs.option(bcs.u64()).serialize(amount); | ||
@@ -77,0 +82,0 @@ const [profits] = tx.moveCall({ |
@@ -6,3 +6,3 @@ // Copyright (c) Mysten Labs, Inc. | ||
import { type SuiClient, type SuiObjectRef } from '@mysten/sui.js/client'; | ||
import { type TransactionArgument } from '@mysten/sui.js/transactions'; | ||
import { TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
@@ -17,3 +17,3 @@ import { BaseRulePackageIds } from '../constants'; | ||
*/ | ||
export type ObjectArgument = string | TransactionArgument | SharedObjectRef | SuiObjectRef; | ||
export type ObjectArgument = string | TransactionObjectArgument | SharedObjectRef | SuiObjectRef; | ||
@@ -20,0 +20,0 @@ /** |
@@ -5,3 +5,3 @@ // Copyright (c) Mysten Labs, Inc. | ||
import { type ObjectOwner } from '@mysten/sui.js/client'; | ||
import { TransactionArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionObjectArgument, type TransactionBlock } from '@mysten/sui.js/transactions'; | ||
@@ -64,6 +64,6 @@ import { ObjectArgument } from '.'; | ||
kioskCap: ObjectArgument; | ||
transferRequest: TransactionArgument; | ||
purchasedItem: TransactionArgument; | ||
transferRequest: TransactionObjectArgument; | ||
purchasedItem: TransactionObjectArgument; | ||
packageId: string; | ||
extraArgs: Record<string, any>; // extraParams contains more possible {key, values} to pass for custom rules. | ||
}; |
@@ -15,3 +15,3 @@ // Copyright (c) Mysten Labs, Inc. | ||
} from '@mysten/sui.js/client'; | ||
import { TransactionArgument, TransactionBlock } from '@mysten/sui.js/transactions'; | ||
import { TransactionBlock, TransactionObjectArgument } from '@mysten/sui.js/transactions'; | ||
import { normalizeSuiAddress } from '@mysten/sui.js/utils'; | ||
@@ -40,4 +40,4 @@ | ||
txb: TransactionBlock, | ||
arg: string | SharedObjectRef | SuiObjectRef | TransactionArgument, | ||
): TransactionArgument { | ||
arg: string | SharedObjectRef | SuiObjectRef | TransactionObjectArgument, | ||
): TransactionObjectArgument { | ||
if (typeof arg === 'string') { | ||
@@ -44,0 +44,0 @@ return txb.object(arg); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
506457
0
+ Added@mysten/bcs@0.8.0(transitive)
+ Added@mysten/sui.js@0.43.0(transitive)
- Removed@mysten/bcs@0.7.4(transitive)
- Removed@mysten/sui.js@0.42.0(transitive)
Updated@mysten/sui.js@0.43.0