Skip to content

Commit

Permalink
Fix declare get nft info (#239)
Browse files Browse the repository at this point in the history
* Declare getNFTinfo

* Declare registeredNFT

Co-authored-by: Dante <[email protected]>
  • Loading branch information
dantefarias and Dante authored Oct 31, 2022
1 parent 55e496f commit 74339e6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 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.24.7",
"version": "0.24.8",
"description": "Internet Computer Plug wallet's controller",
"main": "dist/index.js",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion src/PlugKeyRing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { PlugStateStorage, PlugStateInstance } from '../interfaces/plug_keyring'
import { GetTransactionsResponse } from '../interfaces/transactions';
import { KeyringStorage, StorageData } from '../interfaces/storage';
import { TokenBalance, StandardToken } from '../interfaces/token';
import { WalletNFTCollection } from '../interfaces/plug_wallet';
import { WalletNFTCollection, WalletNFTInfo } from '../interfaces/plug_wallet';
import { Address } from '../interfaces/contact_registry';
import { ERRORS, ERROR_CODES } from '../errors';
import { IdentityFactory } from './../utils/identity/identityFactory'
Expand All @@ -27,6 +27,7 @@ import { getVersion } from '../utils/version';
import Storage from '../utils/storage';

import NetworkModule, { NetworkModuleParams } from './modules/NetworkModule';
import { RegisteredNFT } from './modules/NetworkModule/Network';
import {
CreateAndPersistKeyRingOptions,
CreateImportResponse,
Expand Down Expand Up @@ -73,6 +74,9 @@ class PlugKeyRing {
public getTransactions: (args: { subaccount?: string }) => Promise<GetTransactionsResponse>;
public send: (args: { subaccount?: string, to: string, amount: string, canisterId: string, opts?: TokenInterfaces.SendOpts }) => Promise<TokenInterfaces.SendResponse>;
public delegateIdentity: (args: { to: Buffer, targets: string[], subaccount?: string }) => Promise<string>;
public getNFTInfo: (args: { canisterId: string, standard?: string, subaccount?: string }) => Promise<WalletNFTInfo>;
public registerNFT: (args: { canisterId: string, standard?: string, subaccount?: string }) => Promise<RegisteredNFT[]>;


public constructor(
StorageAdapter = new Storage() as KeyringStorage,
Expand Down
3 changes: 2 additions & 1 deletion src/PlugWallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
ICNSData,
PlugWalletArgs,
WalletNFTCollection,
WalletNFTInfo,
} from '../interfaces/plug_wallet';
import { StandardToken, TokenBalance } from '../interfaces/token';
import { GetTransactionsResponse } from '../interfaces/transactions';
Expand Down Expand Up @@ -213,7 +214,7 @@ class PlugWallet {
return balance;
};

public getNFTInfo = async ({ canisterId, standard }) => {
public getNFTInfo = async ({ canisterId, standard }): Promise<WalletNFTInfo> => {
const nft = await this.network.getNftInfo({ canisterId, identity: this.identity, standard });
return nft;
}
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.24.7";
export const PLUG_CONTROLLER_VERSION = "0.24.8";
4 changes: 4 additions & 0 deletions src/interfaces/plug_wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ export interface NFTDetailsBase<idT = bigint> {
export interface WalletNFTCollection extends Omit<NFTCollection, 'tokens'> {
tokens: NFTDetailsBase<bigint | string>[];
}

export interface WalletNFTInfo extends NFTCollection {
registeredBy: Array<string>;
}

0 comments on commit 74339e6

Please sign in to comment.