@hashgraphonline/hashinal-wc 1.0.86 → 1.0.88
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.
- package/README.md +109 -0
- package/dist/es/hashinal-wc.es.js +189 -5
- package/dist/es/hashinal-wc.es.js.map +1 -1
- package/dist/es/index.d.ts +13 -3
- package/dist/es/types.d.ts +75 -2
- package/dist/index.d.ts +13 -3
- package/dist/types.d.ts +75 -2
- package/dist/umd/hashinal-wc.umd.js +1 -1
- package/dist/umd/hashinal-wc.umd.js.map +1 -1
- package/dist/umd/index.d.ts +13 -3
- package/dist/umd/types.d.ts +75 -2
- package/package.json +1 -1
package/dist/umd/index.d.ts
CHANGED
|
@@ -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 {
|
|
@@ -9,6 +9,8 @@ declare class HashinalsWalletConnectSDK {
|
|
|
9
9
|
private static dAppConnectorInstance;
|
|
10
10
|
private logger;
|
|
11
11
|
private network;
|
|
12
|
+
private extensionCheckInterval;
|
|
13
|
+
private hasCalledExtensionCallback;
|
|
12
14
|
get dAppConnector(): DAppConnector;
|
|
13
15
|
constructor(logger?: ILogger, network?: LedgerId);
|
|
14
16
|
static getInstance(logger?: ILogger, network?: LedgerId): HashinalsWalletConnectSDK;
|
|
@@ -54,10 +56,13 @@ declare class HashinalsWalletConnectSDK {
|
|
|
54
56
|
session: SessionTypes.Struct;
|
|
55
57
|
}>;
|
|
56
58
|
disconnectWallet(clearStorage?: boolean): Promise<boolean>;
|
|
57
|
-
initAccount(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata): Promise<{
|
|
59
|
+
initAccount(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata, networkOverride?: LedgerId, onSessionIframeCreated?: (session: SessionTypes.Struct) => void): Promise<{
|
|
58
60
|
accountId: string;
|
|
59
61
|
balance: string;
|
|
60
62
|
} | null>;
|
|
63
|
+
subscribeToExtensions(callback: (extension: any) => void): () => void;
|
|
64
|
+
connectViaDappBrowser(): Promise<void>;
|
|
65
|
+
private connectToExtension;
|
|
61
66
|
private ensureInitialized;
|
|
62
67
|
static run(): void;
|
|
63
68
|
transferToken(tokenId: string, fromAccountId: string, toAccountId: string, amount: number): Promise<TransactionReceipt>;
|
|
@@ -69,6 +74,11 @@ declare class HashinalsWalletConnectSDK {
|
|
|
69
74
|
getAccountTokens(accountId: string): Promise<{
|
|
70
75
|
tokens: TokenBalance[];
|
|
71
76
|
}>;
|
|
77
|
+
getTransaction(transactionId: string): Promise<HederaTXResponse | null>;
|
|
78
|
+
getTransactionByTimestamp(timestamp: string): Promise<HederaTXResponse | null>;
|
|
79
|
+
getAccountNFTs(accountId: string, tokenId?: string): Promise<Nft[]>;
|
|
80
|
+
validateNFTOwnership(serialNumber: string, accountId: string, tokenId: string): Promise<Nft | null>;
|
|
81
|
+
readSmartContract(data: string, fromAccount: AccountId, contractId: ContractId, estimate?: boolean, value?: number): Promise<any>;
|
|
72
82
|
}
|
|
73
83
|
export * from './types';
|
|
74
84
|
export * from './sign';
|
package/dist/umd/types.d.ts
CHANGED
|
@@ -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,
|
|
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/package.json
CHANGED