diff --git a/package.json b/package.json index 78aa83c5..f2441b23 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "typescript": "^4.5" }, "name": "@psychedelic/plug-controller", - "version": "0.25.1", + "version": "0.25.2", "description": "Internet Computer Plug wallet's controller", "main": "dist/index.js", "scripts": { diff --git a/src/PlugWallet/index.ts b/src/PlugWallet/index.ts index b5e7846d..87beeefd 100644 --- a/src/PlugWallet/index.ts +++ b/src/PlugWallet/index.ts @@ -111,7 +111,7 @@ class PlugWallet { this.name = val; } - public async sign(payload: BinaryBlob): Promise { + public async sign({ payload } : { payload: BinaryBlob }): Promise { return this.identity.sign(payload); } @@ -441,9 +441,10 @@ class PlugWallet { return { names: [], reverseResolvedName: undefined }; const icnsAdapter = new ICNSAdapter(this.agent); const names = await icnsAdapter.getICNSNames(); + const stringNames = names.map((name) => name?.name.toString()); const reverseResolvedName = await icnsAdapter.getICNSReverseResolvedName(); - this.icnsData = { names, reverseResolvedName }; - return { names, reverseResolvedName }; + this.icnsData = { names: stringNames, reverseResolvedName }; + return { names: stringNames, reverseResolvedName }; }; public getReverseResolvedName = async (): Promise => { diff --git a/src/constants/version.ts b/src/constants/version.ts index ad4c3de7..3460eb4a 100644 --- a/src/constants/version.ts +++ b/src/constants/version.ts @@ -1 +1 @@ -export const PLUG_CONTROLLER_VERSION = "0.25.1"; +export const PLUG_CONTROLLER_VERSION = "0.25.2"; diff --git a/src/idls/icns_registry.did.ts b/src/idls/icns_registry.did.ts index 70378824..f14fc59a 100644 --- a/src/idls/icns_registry.did.ts +++ b/src/idls/icns_registry.did.ts @@ -9,6 +9,7 @@ export default ({ IDL }) => { operator: IDL.Principal, name: IDL.Text, expiry: Time, + id: IDL.Nat, }); const Info = IDL.Record({ memSize: IDL.Nat, diff --git a/src/interfaces/icns_registry.ts b/src/interfaces/icns_registry.ts index c44e3050..9ffbcec3 100644 --- a/src/interfaces/icns_registry.ts +++ b/src/interfaces/icns_registry.ts @@ -74,6 +74,7 @@ export interface RecordExt { 'operator' : Principal, 'name' : string, 'expiry' : Time, + 'id': bigint, } export type Time = bigint; export type TxReceipt = { 'ok' : bigint } | diff --git a/src/utils/dfx/icns/index.ts b/src/utils/dfx/icns/index.ts index bb37e84d..473492ad 100644 --- a/src/utils/dfx/icns/index.ts +++ b/src/utils/dfx/icns/index.ts @@ -55,23 +55,24 @@ export default class ICNSAdapter { return principal?.toString?.(); }; - public getICNSNames = async (): Promise => { - const names = await this.#registry.getUserDomains(await this.#agent.getPrincipal()); - return names[0]?.map(({ name }) => name) || []; + public getICNSNames = async (): Promise => { + const _names = await this.#registry.getUserDomains(await this.#agent.getPrincipal()); + const names = _names?.[0] || []; + return names; }; public getICNSCollection = async (): Promise => { let icnsNames = await this.getICNSNames(); const formattedNames = icnsNames?.map( - (name, index) => ({ - name: name, + (name) => ({ + name: name?.name?.toString() || '', + index: name?.id?.toString(), url: ICNS_IMG, collection: 'ICNS', desc: 'ICNS Name Record', canister: ICNS_REGISTRY_ID, - index: BigInt(index), metadata: {}, - standard: standards.NFT.dip721 + standard: standards.NFT.dip721, }), ); return {