Skip to content

Commit

Permalink
update to use utils
Browse files Browse the repository at this point in the history
  • Loading branch information
leecchh committed Dec 17, 2024
1 parent 4ee8c19 commit c84c12b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions sdk/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export const mainPackage: Config = {
payments: {
packageId: '0xe1c0778c7097e727a0dee47ce87a18671456ddbdb1b2dabc027c99dd0a6c2395',
},
utils: {
packageId: '0xd79fd8f79a2c9d139cb9944d5ee99158f5bff7205b14e23a09e86a1e7f45d7fe',
},
registryTableId: '0xa353bcf5adea89def84920513cf888c9d78f304cfd8476a1d831d72c0f92309d',
pyth: {
pythStateId: '0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c',
Expand Down
14 changes: 7 additions & 7 deletions sdk/src/suins-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class SuinsTransaction {
tx.add(this.finalizeRenew(receipt, nftObject));

if (transferNft) {
return nft;
return nft as TransactionObjectArgument;
}

return null;
Expand Down Expand Up @@ -482,22 +482,22 @@ export class SuinsTransaction {
address,
isSubname,
}: {
nft: ObjectArgument;
nft: TransactionObjectArgument;
address?: string;
isSubname?: boolean;
}) {
if (!this.suinsClient.config.suins) throw new Error('SuiNS Object ID not found');
if (!this.suinsClient.config.utils?.packageId) throw new Error('SuiNS Object ID not found');

if (isSubname && !this.suinsClient.config.tempSubdomainsProxyPackageId)
throw new Error('Subnames proxy package ID not found');

this.transaction.moveCall({
target: isSubname
? `${this.suinsClient.config.tempSubdomainsProxyPackageId}::subdomain_proxy::set_target_address`
: `${this.suinsClient.config.packageId}::controller::set_target_address`,
: `${this.suinsClient.config.utils.packageId}::direct_setup::set_target_address`,
arguments: [
this.transaction.object(this.suinsClient.config.suins),
this.transaction.object(nft),
nft,
this.transaction.pure(bcs.option(bcs.Address).serialize(address).toBytes()),
this.transaction.object(SUI_CLOCK_OBJECT_ID),
],
Expand All @@ -508,10 +508,10 @@ export class SuinsTransaction {
setDefault(name: string) {
if (!isValidSuiNSName(name)) throw new Error('Invalid SuiNS name');
if (!this.suinsClient.config.suins) throw new Error('SuiNS Object ID not found');
if (!this.suinsClient.config.utils) throw new Error('Utils package ID not found');
if (!this.suinsClient.config.utils?.packageId) throw new Error('Utils package ID not found');

this.transaction.moveCall({
target: `${this.suinsClient.config.packageId}::controller::set_reverse_lookup`,
target: `${this.suinsClient.config.utils?.packageId}::direct_setup::set_reverse_lookup`,
arguments: [
this.transaction.object(this.suinsClient.config.suins),
this.transaction.pure.string(normalizeSuiNSName(name, 'dot')),
Expand Down

0 comments on commit c84c12b

Please sign in to comment.