pwc-sdk-wallet 0.6.3

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.
Files changed (46) hide show
  1. package/README.md +2062 -0
  2. package/dist/Vault.d.ts +493 -0
  3. package/dist/Vault.js +1090 -0
  4. package/dist/chain/ChainService.d.ts +84 -0
  5. package/dist/chain/ChainService.js +136 -0
  6. package/dist/chain/SolanaChainService.d.ts +94 -0
  7. package/dist/chain/SolanaChainService.js +167 -0
  8. package/dist/config/chains.d.ts +233 -0
  9. package/dist/config/chains.js +285 -0
  10. package/dist/config/constants.d.ts +102 -0
  11. package/dist/config/constants.js +109 -0
  12. package/dist/config/environment.d.ts +46 -0
  13. package/dist/config/environment.js +114 -0
  14. package/dist/config/gas.d.ts +107 -0
  15. package/dist/config/gas.js +123 -0
  16. package/dist/crypto/EncryptionService.d.ts +74 -0
  17. package/dist/crypto/EncryptionService.js +178 -0
  18. package/dist/index.d.ts +22 -0
  19. package/dist/index.js +96 -0
  20. package/dist/keyrings/HDKeyring.d.ts +72 -0
  21. package/dist/keyrings/HDKeyring.js +156 -0
  22. package/dist/keyrings/SimpleKeyring.d.ts +31 -0
  23. package/dist/keyrings/SimpleKeyring.js +49 -0
  24. package/dist/keyrings/SolanaKeyring.d.ts +71 -0
  25. package/dist/keyrings/SolanaKeyring.js +159 -0
  26. package/dist/services/BatchProcessor.d.ts +42 -0
  27. package/dist/services/BatchProcessor.js +188 -0
  28. package/dist/services/MultiTransferService.d.ts +78 -0
  29. package/dist/services/MultiTransferService.js +252 -0
  30. package/dist/services/QRCodeService.d.ts +193 -0
  31. package/dist/services/QRCodeService.js +299 -0
  32. package/dist/services/TokenUtils.d.ts +307 -0
  33. package/dist/services/TokenUtils.js +429 -0
  34. package/dist/services/nft/MetadataResolver.d.ts +57 -0
  35. package/dist/services/nft/MetadataResolver.js +162 -0
  36. package/dist/services/nft/NFTAPIService.d.ts +53 -0
  37. package/dist/services/nft/NFTAPIService.js +122 -0
  38. package/dist/services/nft/NFTService.d.ts +241 -0
  39. package/dist/services/nft/NFTService.js +910 -0
  40. package/dist/types/multiTransfer.d.ts +68 -0
  41. package/dist/types/multiTransfer.js +2 -0
  42. package/dist/types/nft/index.d.ts +68 -0
  43. package/dist/types/nft/index.js +2 -0
  44. package/dist/types/nft.d.ts +265 -0
  45. package/dist/types/nft.js +6 -0
  46. package/package.json +70 -0
@@ -0,0 +1,68 @@
1
+ import { TransactionResponse } from '../Vault';
2
+ /**
3
+ * Represents a recipient for multi-transfer operations.
4
+ */
5
+ export interface Recipient {
6
+ /** The recipient's address */
7
+ address: string;
8
+ /** The amount to transfer (human readable string) */
9
+ amount: string;
10
+ }
11
+ /**
12
+ * Options for multi-transfer operations.
13
+ */
14
+ export interface MultiTransferOptions {
15
+ /** Number of transfers to process in each batch (default: 10) */
16
+ batchSize?: number;
17
+ /** Progress callback function */
18
+ onProgress?: (completed: number, total: number, txHash: string) => void;
19
+ /** Error callback function for failed transfers */
20
+ onError?: (error: Error, recipient: Recipient) => void;
21
+ }
22
+ /**
23
+ * Result of a multi-transfer operation.
24
+ */
25
+ export interface MultiTransferResult {
26
+ /** Successfully completed transactions */
27
+ successful: TransactionResponse[];
28
+ /** Failed transfers with error details */
29
+ failed: {
30
+ recipient: Recipient;
31
+ error: Error;
32
+ }[];
33
+ /** Total gas used across all transactions */
34
+ totalGasUsed: bigint;
35
+ /** Total amount transferred (sum of all successful transfers) */
36
+ totalAmount: string;
37
+ /** Total number of recipients processed */
38
+ totalRecipients: number;
39
+ /** Number of successful transfers */
40
+ successfulCount: number;
41
+ /** Number of failed transfers */
42
+ failedCount: number;
43
+ }
44
+ /**
45
+ * Result of processing a single batch of transfers.
46
+ */
47
+ export interface BatchResult {
48
+ /** Completed transactions in this batch */
49
+ transactions: TransactionResponse[];
50
+ /** Failed transfers in this batch */
51
+ failed: {
52
+ recipient: Recipient;
53
+ error: Error;
54
+ }[];
55
+ /** Gas used for this batch */
56
+ gasUsed: bigint;
57
+ }
58
+ /**
59
+ * Validation result for multi-transfer inputs.
60
+ */
61
+ export interface ValidationResult {
62
+ /** Whether validation passed */
63
+ isValid: boolean;
64
+ /** Validation errors if any */
65
+ errors: string[];
66
+ /** Total amount to be transferred */
67
+ totalAmount: string;
68
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Basic NFT information interface
3
+ */
4
+ export interface NFTDetail {
5
+ contractAddress: string;
6
+ contractName: string;
7
+ contractSymbol: string;
8
+ tokenId: string;
9
+ tokenType: 'ERC-721' | 'ERC-1155' | 'SPL-NFT';
10
+ name: string;
11
+ description: string;
12
+ image: string;
13
+ externalUrl?: string;
14
+ owner: string;
15
+ balance: number;
16
+ }
17
+ /**
18
+ * Extended NFT information with metadata
19
+ */
20
+ export interface NFTDetailExtended extends NFTDetail {
21
+ attributes?: Array<{
22
+ trait_type: string;
23
+ value: string;
24
+ display_type?: string;
25
+ }>;
26
+ }
27
+ /**
28
+ * Collection information
29
+ */
30
+ export interface CollectionInfo {
31
+ name: string;
32
+ description: string;
33
+ image: string;
34
+ banner: string;
35
+ verified: boolean;
36
+ contractAddress: string;
37
+ totalSupply: number;
38
+ }
39
+ /**
40
+ * NFT metadata from contract
41
+ */
42
+ export interface NFTMetadata {
43
+ name: string;
44
+ description: string;
45
+ image: string;
46
+ externalUrl?: string;
47
+ attributes?: Array<{
48
+ trait_type: string;
49
+ value: string;
50
+ display_type?: string;
51
+ }>;
52
+ }
53
+ /**
54
+ * Options for NFT queries
55
+ */
56
+ export interface NFTOptions {
57
+ includeMetadata?: boolean;
58
+ limit?: number;
59
+ offset?: number;
60
+ }
61
+ /**
62
+ * NFT API response wrapper
63
+ */
64
+ export interface NFTAPIResponse<T> {
65
+ data: T;
66
+ success: boolean;
67
+ error?: string;
68
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,265 @@
1
+ /**
2
+ * NFT Types and Interfaces for PWC Wallet SDK
3
+ * Defines the structure of NFT detail responses
4
+ */
5
+ /**
6
+ * Creator/Artist information
7
+ */
8
+ export interface NFTCreator {
9
+ /** Creator's address */
10
+ address: string;
11
+ /** Creator's name/username */
12
+ name?: string;
13
+ /** Creator's profile image */
14
+ avatar?: string;
15
+ /** Creator's bio/description */
16
+ bio?: string;
17
+ /** Creator's website */
18
+ website?: string;
19
+ /** Creator's social media links */
20
+ social?: {
21
+ twitter?: string;
22
+ instagram?: string;
23
+ discord?: string;
24
+ telegram?: string;
25
+ youtube?: string;
26
+ };
27
+ /** Royalty percentage for this creator */
28
+ royaltyPercentage?: number;
29
+ /** Whether creator is verified */
30
+ verified?: boolean;
31
+ /** Creator's total works count */
32
+ totalWorks?: number;
33
+ /** Creator's total sales volume */
34
+ totalVolume?: {
35
+ amount: string;
36
+ currency: string;
37
+ };
38
+ }
39
+ /**
40
+ * Basic NFT attribute (trait) information
41
+ */
42
+ export interface NFTAttribute {
43
+ trait_type: string;
44
+ value: string | number;
45
+ display_type?: 'number' | 'boost_number' | 'boost_percentage' | 'date';
46
+ max_value?: number;
47
+ }
48
+ /**
49
+ * NFT metadata from IPFS or HTTP
50
+ */
51
+ export interface NFTMetadata {
52
+ name: string;
53
+ description?: string;
54
+ image?: string;
55
+ external_url?: string;
56
+ animation_url?: string;
57
+ attributes?: NFTAttribute[];
58
+ background_color?: string;
59
+ youtube_url?: string;
60
+ image_data?: string;
61
+ /** Creator information in metadata */
62
+ creator?: string;
63
+ artist?: string;
64
+ }
65
+ /**
66
+ * Collection information
67
+ */
68
+ export interface CollectionInfo {
69
+ name: string;
70
+ description?: string;
71
+ image?: string;
72
+ external_url?: string;
73
+ royalty_percentage?: number;
74
+ verified?: boolean;
75
+ floor_price?: {
76
+ amount: string;
77
+ currency: string;
78
+ timestamp: number;
79
+ };
80
+ total_supply?: number;
81
+ owners_count?: number;
82
+ /** Collection creator */
83
+ creator?: NFTCreator;
84
+ /** Collection artists */
85
+ artists?: NFTCreator[];
86
+ }
87
+ /**
88
+ * Transaction history for an NFT
89
+ */
90
+ export interface NFTTransaction {
91
+ hash: string;
92
+ from: string;
93
+ to: string;
94
+ blockNumber: number;
95
+ timestamp: number;
96
+ type: 'mint' | 'transfer' | 'sale' | 'bid' | 'list' | 'cancel';
97
+ price?: {
98
+ amount: string;
99
+ currency: string;
100
+ };
101
+ gas_used?: bigint;
102
+ gas_price?: bigint;
103
+ /** Creator address for mint transactions */
104
+ creator?: string;
105
+ }
106
+ /**
107
+ * Market data for an NFT
108
+ */
109
+ export interface NFTMarketData {
110
+ floor_price?: {
111
+ amount: string;
112
+ currency: string;
113
+ timestamp: number;
114
+ };
115
+ last_sale?: {
116
+ amount: string;
117
+ currency: string;
118
+ timestamp: number;
119
+ hash: string;
120
+ };
121
+ offers?: Array<{
122
+ amount: string;
123
+ currency: string;
124
+ from: string;
125
+ expires_at: number;
126
+ }>;
127
+ listings?: Array<{
128
+ amount: string;
129
+ currency: string;
130
+ from: string;
131
+ expires_at: number;
132
+ }>;
133
+ rarity_rank?: number;
134
+ rarity_score?: number;
135
+ /** Creator royalties */
136
+ creatorRoyalties?: {
137
+ percentage: number;
138
+ address: string;
139
+ };
140
+ }
141
+ /**
142
+ * Basic NFT detail interface containing essential on-chain data
143
+ */
144
+ export interface NFTDetail {
145
+ /** NFT contract address */
146
+ contractAddress: string;
147
+ /** Token ID */
148
+ tokenId: string;
149
+ /** NFT name (from metadata or fallback) */
150
+ name: string;
151
+ /** NFT description (from metadata) */
152
+ description?: string;
153
+ /** NFT image URL (from metadata) */
154
+ image?: string;
155
+ /** NFT attributes/traits (from metadata) */
156
+ attributes?: NFTAttribute[];
157
+ /** Current owner address */
158
+ owner: string;
159
+ /** Token type (ERC-721, ERC-1155, SPL-NFT) */
160
+ tokenType: 'ERC-721' | 'ERC-1155' | 'SPL-NFT';
161
+ /** Chain ID where NFT exists */
162
+ chainId: string;
163
+ /** Token URI for metadata */
164
+ tokenUri?: string;
165
+ /** When NFT was minted (timestamp) */
166
+ createdAt?: number;
167
+ /** Last transfer timestamp */
168
+ lastTransferAt?: number;
169
+ }
170
+ /**
171
+ * Extended NFT detail with additional blockchain data
172
+ */
173
+ export interface NFTDetailExtended extends NFTDetail {
174
+ /** Resolved metadata from tokenURI */
175
+ metadata?: NFTMetadata;
176
+ /** Collection information */
177
+ collection?: NFTCollection;
178
+ /** Transaction history from blockchain events */
179
+ transactionHistory: NFTTransaction[];
180
+ /** Source of metadata (ipfs, http) */
181
+ metadataSource?: 'ipfs' | 'http';
182
+ /** Last time data was updated */
183
+ lastUpdated: number;
184
+ }
185
+ /**
186
+ * NFT collection information from blockchain
187
+ */
188
+ export interface NFTCollection {
189
+ /** Collection contract address */
190
+ contractAddress: string;
191
+ /** Collection name */
192
+ name: string;
193
+ /** Collection symbol */
194
+ symbol?: string;
195
+ /** Token type */
196
+ tokenType: 'ERC-721' | 'ERC-1155' | 'SPL-NFT';
197
+ /** Chain ID */
198
+ chainId: string;
199
+ /** Total supply */
200
+ totalSupply?: number;
201
+ /** Collection description */
202
+ description?: string;
203
+ /** Collection image */
204
+ image?: string;
205
+ /** Collection external URL */
206
+ externalUrl?: string;
207
+ }
208
+ /**
209
+ * NFT balance for an address
210
+ */
211
+ export interface NFTBalance {
212
+ /** Contract address */
213
+ contractAddress: string;
214
+ /** Token IDs owned by address */
215
+ tokenIds: string[];
216
+ /** Number of tokens owned */
217
+ count: number;
218
+ /** Token type */
219
+ tokenType: 'ERC-721' | 'ERC-1155' | 'SPL-NFT';
220
+ /** Chain ID */
221
+ chainId: string;
222
+ }
223
+ /**
224
+ * NFT query options
225
+ */
226
+ export interface NFTOptions {
227
+ /** Include resolved metadata */
228
+ includeMetadata?: boolean;
229
+ /** Include collection information */
230
+ includeCollection?: boolean;
231
+ /** Include transaction history */
232
+ includeHistory?: boolean;
233
+ /** Include market data (not available in pure blockchain) */
234
+ includeMarketData?: boolean;
235
+ /** Include rarity data (not available in pure blockchain) */
236
+ includeRarity?: boolean;
237
+ }
238
+ /**
239
+ * NFT search filters
240
+ */
241
+ export interface NFTSearchFilters {
242
+ /** Contract address */
243
+ contractAddress?: string;
244
+ /** Token ID */
245
+ tokenId?: string;
246
+ /** Owner address */
247
+ owner?: string;
248
+ /** Token type */
249
+ tokenType?: 'ERC-721' | 'ERC-1155' | 'SPL-NFT';
250
+ /** Chain ID */
251
+ chainId?: string;
252
+ }
253
+ /**
254
+ * NFT search result
255
+ */
256
+ export interface NFTSearchResult {
257
+ /** Array of NFT details */
258
+ nfts: NFTDetail[];
259
+ /** Total count */
260
+ total: number;
261
+ /** Has more results */
262
+ hasMore: boolean;
263
+ /** Next page token */
264
+ nextPageToken?: string;
265
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * NFT Types and Interfaces for PWC Wallet SDK
4
+ * Defines the structure of NFT detail responses
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "pwc-sdk-wallet",
3
+ "version": "0.6.3",
4
+ "description": "A comprehensive wallet SDK for React Native (pwc), supporting multi-chain and multi-account features.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist/",
9
+ "README.md"
10
+ ],
11
+ "scripts": {
12
+ "build": "npm run clean && tsc",
13
+ "clean": "rimraf dist",
14
+ "prepublishOnly": "npm run build",
15
+ "test": "jest",
16
+ "test:watch": "jest --watch",
17
+ "test:coverage": "jest --coverage"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/your-username/p-sdk-wallet.git"
22
+ },
23
+ "keywords": [
24
+ "react-native",
25
+ "wallet",
26
+ "pwc",
27
+ "crypto",
28
+ "ethereum",
29
+ "ethers"
30
+ ],
31
+ "author": "Your Name <your.email@example.com>",
32
+ "license": "MIT",
33
+ "bugs": {
34
+ "url": "https://github.com/your-username/p-sdk-wallet/issues"
35
+ },
36
+ "homepage": "https://github.com/your-username/p-sdk-wallet#readme",
37
+ "dependencies": {
38
+ "@bitcoinerlab/secp256k1": "^1.1.1",
39
+ "@solana/spl-token": "^0.4.13",
40
+ "@solana/web3.js": "^1.98.2",
41
+ "bip32": "^4.0.0",
42
+ "bip39": "^3.1.0",
43
+ "bs58": "^6.0.0",
44
+ "buffer": "^6.0.3",
45
+ "crypto-js": "^4.2.0",
46
+ "ed25519-hd-key": "^1.3.0",
47
+ "react-native-camera": "^4.2.1",
48
+ "react-native-permissions": "^5.4.1",
49
+ "react-native-qrcode-svg": "^6.3.15",
50
+ "react-native-svg": "^15.12.0"
51
+ },
52
+ "peerDependencies": {
53
+ "@react-native-async-storage/async-storage": "^1.21.0",
54
+ "ethers": "^6.0.0",
55
+ "react": "*",
56
+ "react-native": "*",
57
+ "react-native-get-random-values": "^1.9.0",
58
+ "react-native-keychain": "^8.2.0"
59
+ },
60
+ "devDependencies": {
61
+ "@types/crypto-js": "^4.2.2",
62
+ "@types/jest": "^29.5.0",
63
+ "@types/react": "^18.0.0 || ^19.0.0",
64
+ "jest": "^29.5.0",
65
+ "rimraf": "^5.0.5",
66
+ "ts-jest": "^29.1.0",
67
+ "typescript": "^5.3.3",
68
+ "@react-native-community/cli": "latest"
69
+ }
70
+ }