Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Psychedelic/plug-controller into fi…
Browse files Browse the repository at this point in the history
…x/dab-nfts
  • Loading branch information
rocky-fleek committed Nov 23, 2022
2 parents 4e957bb + 465a4a7 commit 7869152
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 4 additions & 3 deletions src/PlugWallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class PlugWallet {
this.name = val;
}

public async sign(payload: BinaryBlob): Promise<BinaryBlob> {
public async sign({ payload } : { payload: BinaryBlob }): Promise<BinaryBlob> {
return this.identity.sign(payload);
}

Expand Down Expand Up @@ -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<string | undefined> => {
Expand Down
2 changes: 1 addition & 1 deletion src/constants/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const PLUG_CONTROLLER_VERSION = "0.25.1";
export const PLUG_CONTROLLER_VERSION = "0.25.2";
1 change: 1 addition & 0 deletions src/idls/icns_registry.did.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/icns_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface RecordExt {
'operator' : Principal,
'name' : string,
'expiry' : Time,
'id': bigint,
}
export type Time = bigint;
export type TxReceipt = { 'ok' : bigint } |
Expand Down
15 changes: 8 additions & 7 deletions src/utils/dfx/icns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,24 @@ export default class ICNSAdapter {
return principal?.toString?.();
};

public getICNSNames = async (): Promise<string[]> => {
const names = await this.#registry.getUserDomains(await this.#agent.getPrincipal());
return names[0]?.map(({ name }) => name) || [];
public getICNSNames = async (): Promise<RecordExt[]> => {
const _names = await this.#registry.getUserDomains(await this.#agent.getPrincipal());
const names = _names?.[0] || [];
return names;
};

public getICNSCollection = async (): Promise<NFTCollection> => {
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 {
Expand Down

0 comments on commit 7869152

Please sign in to comment.