@hashgraphonline/hashinal-wc 1.0.85 → 1.0.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { SessionTypes, SignClientTypes } from '@walletconnect/types';
2
- import { Transaction, LedgerId, TransactionReceipt, ContractFunctionParameters, PrivateKey } from '@hashgraph/sdk';
2
+ import { Transaction, AccountId, ContractId, LedgerId, TransactionReceipt, ContractFunctionParameters, PrivateKey } from '@hashgraph/sdk';
3
3
  import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
4
- import { FetchMessagesResult, TokenBalance, HederaAccountResponse } from './types';
4
+ import { FetchMessagesResult, TokenBalance, HederaAccountResponse, HederaTXResponse, Nft } from './types';
5
5
  import { ILogger } from './logger/logger';
6
6
  import * as HashgraphSDK from '@hashgraph/sdk';
7
7
  declare class HashinalsWalletConnectSDK {
@@ -69,6 +69,11 @@ declare class HashinalsWalletConnectSDK {
69
69
  getAccountTokens(accountId: string): Promise<{
70
70
  tokens: TokenBalance[];
71
71
  }>;
72
+ getTransaction(transactionId: string): Promise<HederaTXResponse | null>;
73
+ getTransactionByTimestamp(timestamp: string): Promise<HederaTXResponse | null>;
74
+ getAccountNFTs(accountId: string, tokenId?: string): Promise<Nft[]>;
75
+ validateNFTOwnership(serialNumber: string, accountId: string, tokenId: string): Promise<Nft | null>;
76
+ readSmartContract(data: string, fromAccount: AccountId, contractId: ContractId, estimate?: boolean, value?: number): Promise<any>;
72
77
  }
73
78
  export * from './types';
74
79
  export * from './sign';
@@ -1,5 +1,5 @@
1
1
  import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
2
- import { ContractFunctionParameters, TransactionReceipt, PrivateKey, Transaction } from '@hashgraph/sdk';
2
+ import { ContractFunctionParameters, TransactionReceipt, PrivateKey, Transaction, AccountId, ContractId } from '@hashgraph/sdk';
3
3
  import { SessionTypes, SignClientTypes } from '@walletconnect/types';
4
4
  import * as hashgraph from '@hashgraph/sdk';
5
5
  export interface HederaAccountResponse {
@@ -135,6 +135,72 @@ export interface TokenBalance {
135
135
  created_timestamp: Date;
136
136
  formatted_balance: string;
137
137
  }
138
+ export interface HederaTXResponse {
139
+ transactions: MirrorNodeTransaction[];
140
+ }
141
+ export interface MirrorNodeTransaction {
142
+ bytes: null;
143
+ charged_tx_fee: number;
144
+ consensus_timestamp: string;
145
+ entity_id: string;
146
+ max_fee: string;
147
+ memo_base64: string;
148
+ name: string;
149
+ node: null | string;
150
+ nonce: number;
151
+ parent_consensus_timestamp: null | string;
152
+ result: string;
153
+ scheduled: boolean;
154
+ transaction_hash: string;
155
+ transaction_id: string;
156
+ transfers: Transfer[];
157
+ token_transfers: TokenTransfer[];
158
+ valid_duration_seconds: null | string;
159
+ valid_start_timestamp: string;
160
+ nft_transfers?: NftTransfer[];
161
+ }
162
+ export interface NftTransfer {
163
+ is_approval: boolean;
164
+ receiver_account_id: string;
165
+ sender_account_id: string;
166
+ serial_number: number;
167
+ token_id: string;
168
+ }
169
+ export interface TokenTransfer {
170
+ token_id: string;
171
+ account: string;
172
+ amount: number;
173
+ }
174
+ export interface HBarNFT {
175
+ nfts: Nft[];
176
+ links: Links;
177
+ }
178
+ export interface Links {
179
+ next: string;
180
+ }
181
+ export interface Nft {
182
+ account_id: string;
183
+ created_timestamp: string;
184
+ delegating_spender: null;
185
+ deleted: boolean;
186
+ metadata: string;
187
+ modified_timestamp: string;
188
+ serial_number: number;
189
+ spender: null;
190
+ token_id: string;
191
+ token_uri?: string;
192
+ owner_of?: string;
193
+ }
194
+ export interface FormattedOwner {
195
+ token_uri?: string;
196
+ chain?: string;
197
+ owner_of?: string;
198
+ token_address?: string;
199
+ token_id?: string;
200
+ account_id?: string;
201
+ serial_number?: number;
202
+ [key: string]: any;
203
+ }
138
204
  export type HashinalsWalletConnectSDK = {
139
205
  run: () => void;
140
206
  init: (projectId: string, metadata: SignClientTypes.Metadata) => Promise<DAppConnector>;
@@ -154,6 +220,8 @@ export type HashinalsWalletConnectSDK = {
154
220
  result?: TransactionReceipt;
155
221
  error?: string;
156
222
  }>;
223
+ result?: TransactionReceipt;
224
+ error?: string;
157
225
  submitMessageToTopic: (topicId: string, message: string) => Promise<TransactionReceipt>;
158
226
  transferHbar: (fromAccountId: string, toAccountId: string, amount: number) => Promise<TransactionReceipt>;
159
227
  executeSmartContract: (contractId: string, functionName: string, parameters: ContractFunctionParameters, gas?: number) => Promise<TransactionReceipt>;
@@ -163,7 +231,7 @@ export type HashinalsWalletConnectSDK = {
163
231
  createToken: (name: string, symbol: string, initialSupply: number, decimals: number, treasuryAccountId: string, adminKey: string, supplyKey: string) => Promise<string>;
164
232
  mintNFT: (tokenId: string, metadata: string, supplyKey: PrivateKey) => Promise<TransactionReceipt>;
165
233
  dAppConnector?: DAppConnector;
166
- getMessages: (topicId: string, collectedMessages: Message[], lastTimestamp?: number, disableTimestampFilter?: boolean, nextUrl?: string) => Promise<FetchMessagesResult>;
234
+ getMessages: (topicId: string, lastTimestamp?: number, disableTimestampFilter?: boolean) => Promise<FetchMessagesResult>;
167
235
  initAccount: (PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata) => Promise<{
168
236
  accountId: string;
169
237
  balance: string;
@@ -177,5 +245,10 @@ export type HashinalsWalletConnectSDK = {
177
245
  getAccountTokens: (accountId: string) => Promise<{
178
246
  tokens: TokenBalance[];
179
247
  }>;
248
+ getTransaction: (transactionId: string) => Promise<HederaTXResponse | null>;
249
+ getTransactionByTimestamp: (timestamp: string) => Promise<HederaTXResponse | null>;
250
+ getAccountNFTs: (accountId: string, tokenId?: string) => Promise<Nft[]>;
251
+ validateNFTOwnership: (serialNumber: string, accountId: string, tokenId: string) => Promise<Nft | null>;
252
+ readSmartContract: (data: string, fromAccount: AccountId, contractId: ContractId, estimate?: boolean, value?: number) => Promise<any>;
180
253
  HashgraphSDK: typeof hashgraph;
181
254
  };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { SessionTypes, SignClientTypes } from '@walletconnect/types';
2
- import { Transaction, LedgerId, TransactionReceipt, ContractFunctionParameters, PrivateKey } from '@hashgraph/sdk';
2
+ import { Transaction, AccountId, ContractId, LedgerId, TransactionReceipt, ContractFunctionParameters, PrivateKey } from '@hashgraph/sdk';
3
3
  import * as HashgraphSDK from '@hashgraph/sdk';
4
4
  import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
5
- import { FetchMessagesResult, TokenBalance, HederaAccountResponse } from './types';
5
+ import { FetchMessagesResult, TokenBalance, HederaAccountResponse, HederaTXResponse, Nft } from './types';
6
6
  import { ILogger } from './logger/logger';
7
7
  declare class HashinalsWalletConnectSDK {
8
8
  private static instance;
@@ -69,6 +69,11 @@ declare class HashinalsWalletConnectSDK {
69
69
  getAccountTokens(accountId: string): Promise<{
70
70
  tokens: TokenBalance[];
71
71
  }>;
72
+ getTransaction(transactionId: string): Promise<HederaTXResponse | null>;
73
+ getTransactionByTimestamp(timestamp: string): Promise<HederaTXResponse | null>;
74
+ getAccountNFTs(accountId: string, tokenId?: string): Promise<Nft[]>;
75
+ validateNFTOwnership(serialNumber: string, accountId: string, tokenId: string): Promise<Nft | null>;
76
+ readSmartContract(data: string, fromAccount: AccountId, contractId: ContractId, estimate?: boolean, value?: number): Promise<any>;
72
77
  }
73
78
  export * from './types';
74
79
  export * from './sign';
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
2
2
  import * as hashgraph from '@hashgraph/sdk';
3
- import { ContractFunctionParameters, TransactionReceipt, PrivateKey, Transaction } from '@hashgraph/sdk';
3
+ import { ContractFunctionParameters, TransactionReceipt, PrivateKey, Transaction, AccountId, ContractId } from '@hashgraph/sdk';
4
4
  import { SessionTypes, SignClientTypes } from '@walletconnect/types';
5
5
  export interface HederaAccountResponse {
6
6
  account: string;
@@ -135,6 +135,72 @@ export interface TokenBalance {
135
135
  created_timestamp: Date;
136
136
  formatted_balance: string;
137
137
  }
138
+ export interface HederaTXResponse {
139
+ transactions: MirrorNodeTransaction[];
140
+ }
141
+ export interface MirrorNodeTransaction {
142
+ bytes: null;
143
+ charged_tx_fee: number;
144
+ consensus_timestamp: string;
145
+ entity_id: string;
146
+ max_fee: string;
147
+ memo_base64: string;
148
+ name: string;
149
+ node: null | string;
150
+ nonce: number;
151
+ parent_consensus_timestamp: null | string;
152
+ result: string;
153
+ scheduled: boolean;
154
+ transaction_hash: string;
155
+ transaction_id: string;
156
+ transfers: Transfer[];
157
+ token_transfers: TokenTransfer[];
158
+ valid_duration_seconds: null | string;
159
+ valid_start_timestamp: string;
160
+ nft_transfers?: NftTransfer[];
161
+ }
162
+ export interface NftTransfer {
163
+ is_approval: boolean;
164
+ receiver_account_id: string;
165
+ sender_account_id: string;
166
+ serial_number: number;
167
+ token_id: string;
168
+ }
169
+ export interface TokenTransfer {
170
+ token_id: string;
171
+ account: string;
172
+ amount: number;
173
+ }
174
+ export interface HBarNFT {
175
+ nfts: Nft[];
176
+ links: Links;
177
+ }
178
+ export interface Links {
179
+ next: string;
180
+ }
181
+ export interface Nft {
182
+ account_id: string;
183
+ created_timestamp: string;
184
+ delegating_spender: null;
185
+ deleted: boolean;
186
+ metadata: string;
187
+ modified_timestamp: string;
188
+ serial_number: number;
189
+ spender: null;
190
+ token_id: string;
191
+ token_uri?: string;
192
+ owner_of?: string;
193
+ }
194
+ export interface FormattedOwner {
195
+ token_uri?: string;
196
+ chain?: string;
197
+ owner_of?: string;
198
+ token_address?: string;
199
+ token_id?: string;
200
+ account_id?: string;
201
+ serial_number?: number;
202
+ [key: string]: any;
203
+ }
138
204
  export type HashinalsWalletConnectSDK = {
139
205
  run: () => void;
140
206
  init: (projectId: string, metadata: SignClientTypes.Metadata) => Promise<DAppConnector>;
@@ -154,6 +220,8 @@ export type HashinalsWalletConnectSDK = {
154
220
  result?: TransactionReceipt;
155
221
  error?: string;
156
222
  }>;
223
+ result?: TransactionReceipt;
224
+ error?: string;
157
225
  submitMessageToTopic: (topicId: string, message: string) => Promise<TransactionReceipt>;
158
226
  transferHbar: (fromAccountId: string, toAccountId: string, amount: number) => Promise<TransactionReceipt>;
159
227
  executeSmartContract: (contractId: string, functionName: string, parameters: ContractFunctionParameters, gas?: number) => Promise<TransactionReceipt>;
@@ -163,7 +231,7 @@ export type HashinalsWalletConnectSDK = {
163
231
  createToken: (name: string, symbol: string, initialSupply: number, decimals: number, treasuryAccountId: string, adminKey: string, supplyKey: string) => Promise<string>;
164
232
  mintNFT: (tokenId: string, metadata: string, supplyKey: PrivateKey) => Promise<TransactionReceipt>;
165
233
  dAppConnector?: DAppConnector;
166
- getMessages: (topicId: string, collectedMessages: Message[], lastTimestamp?: number, disableTimestampFilter?: boolean, nextUrl?: string) => Promise<FetchMessagesResult>;
234
+ getMessages: (topicId: string, lastTimestamp?: number, disableTimestampFilter?: boolean) => Promise<FetchMessagesResult>;
167
235
  initAccount: (PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata) => Promise<{
168
236
  accountId: string;
169
237
  balance: string;
@@ -177,5 +245,10 @@ export type HashinalsWalletConnectSDK = {
177
245
  getAccountTokens: (accountId: string) => Promise<{
178
246
  tokens: TokenBalance[];
179
247
  }>;
248
+ getTransaction: (transactionId: string) => Promise<HederaTXResponse | null>;
249
+ getTransactionByTimestamp: (timestamp: string) => Promise<HederaTXResponse | null>;
250
+ getAccountNFTs: (accountId: string, tokenId?: string) => Promise<Nft[]>;
251
+ validateNFTOwnership: (serialNumber: string, accountId: string, tokenId: string) => Promise<Nft | null>;
252
+ readSmartContract: (data: string, fromAccount: AccountId, contractId: ContractId, estimate?: boolean, value?: number) => Promise<any>;
180
253
  HashgraphSDK: typeof hashgraph;
181
254
  };