@varity-labs/sdk 2.0.0-alpha.1
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/LICENSE +31 -0
- package/README.md +253 -0
- package/dist/analytics/index.d.ts +7 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js +6 -0
- package/dist/analytics/tracker.d.ts +128 -0
- package/dist/analytics/tracker.d.ts.map +1 -0
- package/dist/analytics/tracker.js +203 -0
- package/dist/blockchain/BlockchainService.d.ts +100 -0
- package/dist/blockchain/BlockchainService.d.ts.map +1 -0
- package/dist/blockchain/BlockchainService.js +188 -0
- package/dist/blockchain/NFTLicensingService.d.ts +69 -0
- package/dist/blockchain/NFTLicensingService.d.ts.map +1 -0
- package/dist/blockchain/NFTLicensingService.js +136 -0
- package/dist/blockchain/RevenueSplitService.d.ts +71 -0
- package/dist/blockchain/RevenueSplitService.d.ts.map +1 -0
- package/dist/blockchain/RevenueSplitService.js +111 -0
- package/dist/blockchain/index.d.ts +48 -0
- package/dist/blockchain/index.d.ts.map +1 -0
- package/dist/blockchain/index.js +46 -0
- package/dist/blockchain/types.d.ts +63 -0
- package/dist/blockchain/types.d.ts.map +1 -0
- package/dist/blockchain/types.js +6 -0
- package/dist/chains/arbitrum.d.ts +89 -0
- package/dist/chains/arbitrum.d.ts.map +1 -0
- package/dist/chains/arbitrum.js +134 -0
- package/dist/chains/base.d.ts +84 -0
- package/dist/chains/base.d.ts.map +1 -0
- package/dist/chains/base.js +131 -0
- package/dist/chains/index.d.ts +36 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +32 -0
- package/dist/chains/registry.d.ts +113 -0
- package/dist/chains/registry.d.ts.map +1 -0
- package/dist/chains/registry.js +201 -0
- package/dist/chains/varityL3.d.ts +81 -0
- package/dist/chains/varityL3.d.ts.map +1 -0
- package/dist/chains/varityL3.js +125 -0
- package/dist/cli/commands/clone.d.ts +8 -0
- package/dist/cli/commands/clone.d.ts.map +1 -0
- package/dist/cli/commands/clone.js +391 -0
- package/dist/cli/commands/dev.d.ts +8 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +40 -0
- package/dist/cli/commands/generate.d.ts +8 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +303 -0
- package/dist/cli/commands/init.d.ts +8 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +317 -0
- package/dist/cli/commands/validate.d.ts +8 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +69 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +33 -0
- package/dist/cli/utils/logger.d.ts +17 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +35 -0
- package/dist/cli/utils/prompts.d.ts +21 -0
- package/dist/cli/utils/prompts.d.ts.map +1 -0
- package/dist/cli/utils/prompts.js +103 -0
- package/dist/contracts/abis/iso/AccessControlRegistry.json +1468 -0
- package/dist/contracts/abis/iso/DataProofRegistry.json +797 -0
- package/dist/contracts/abis/iso/MerchantRegistry.json +1237 -0
- package/dist/contracts/abis/iso/RepPerformance.json +1351 -0
- package/dist/contracts/abis/iso/ResidualCalculator.json +1118 -0
- package/dist/contracts/abis/iso/TransactionVault.json +1588 -0
- package/dist/contracts/abis/iso/VarityWalletFactory.json +475 -0
- package/dist/contracts/addresses.d.ts +88 -0
- package/dist/contracts/addresses.d.ts.map +1 -0
- package/dist/contracts/addresses.js +94 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +6 -0
- package/dist/core/VaritySDK.d.ts +177 -0
- package/dist/core/VaritySDK.d.ts.map +1 -0
- package/dist/core/VaritySDK.js +325 -0
- package/dist/core/config.d.ts +120 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +187 -0
- package/dist/core/credentials-proxy.d.ts +157 -0
- package/dist/core/credentials-proxy.d.ts.map +1 -0
- package/dist/core/credentials-proxy.js +345 -0
- package/dist/core/credentials.d.ts +219 -0
- package/dist/core/credentials.d.ts.map +1 -0
- package/dist/core/credentials.js +345 -0
- package/dist/core/template-loader.d.ts +15 -0
- package/dist/core/template-loader.d.ts.map +1 -0
- package/dist/core/template-loader.js +380 -0
- package/dist/core/template.d.ts +321 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/template.js +189 -0
- package/dist/core/types.d.ts +572 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +52 -0
- package/dist/dev/dev-server.d.ts +16 -0
- package/dist/dev/dev-server.d.ts.map +1 -0
- package/dist/dev/dev-server.js +119 -0
- package/dist/generators/contracts/generator.d.ts +21 -0
- package/dist/generators/contracts/generator.d.ts.map +1 -0
- package/dist/generators/contracts/generator.js +252 -0
- package/dist/generators/tests/generator.d.ts +20 -0
- package/dist/generators/tests/generator.d.ts.map +1 -0
- package/dist/generators/tests/generator.js +375 -0
- package/dist/generators/types/generator.d.ts +19 -0
- package/dist/generators/types/generator.d.ts.map +1 -0
- package/dist/generators/types/generator.js +165 -0
- package/dist/generators/ui/component-generator.d.ts +20 -0
- package/dist/generators/ui/component-generator.d.ts.map +1 -0
- package/dist/generators/ui/component-generator.js +749 -0
- package/dist/generators/ui/dashboard-generator.d.ts +20 -0
- package/dist/generators/ui/dashboard-generator.d.ts.map +1 -0
- package/dist/generators/ui/dashboard-generator.js +349 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/modules/analytics/AnalyticsModule.d.ts +349 -0
- package/dist/modules/analytics/AnalyticsModule.d.ts.map +1 -0
- package/dist/modules/analytics/AnalyticsModule.js +274 -0
- package/dist/modules/analytics/index.d.ts +3 -0
- package/dist/modules/analytics/index.d.ts.map +1 -0
- package/dist/modules/analytics/index.js +1 -0
- package/dist/modules/auth/AccessKeyModule.d.ts +189 -0
- package/dist/modules/auth/AccessKeyModule.d.ts.map +1 -0
- package/dist/modules/auth/AccessKeyModule.js +322 -0
- package/dist/modules/auth/AuthModule.d.ts +133 -0
- package/dist/modules/auth/AuthModule.d.ts.map +1 -0
- package/dist/modules/auth/AuthModule.js +214 -0
- package/dist/modules/auth/index.d.ts +8 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +6 -0
- package/dist/modules/cache/CacheModule.d.ts +279 -0
- package/dist/modules/cache/CacheModule.d.ts.map +1 -0
- package/dist/modules/cache/CacheModule.js +493 -0
- package/dist/modules/cache/index.d.ts +3 -0
- package/dist/modules/cache/index.d.ts.map +1 -0
- package/dist/modules/cache/index.js +1 -0
- package/dist/modules/compute/ComputeModule.d.ts +226 -0
- package/dist/modules/compute/ComputeModule.d.ts.map +1 -0
- package/dist/modules/compute/ComputeModule.js +379 -0
- package/dist/modules/compute/index.d.ts +6 -0
- package/dist/modules/compute/index.d.ts.map +1 -0
- package/dist/modules/compute/index.js +4 -0
- package/dist/modules/contracts/ContractsModule.d.ts +164 -0
- package/dist/modules/contracts/ContractsModule.d.ts.map +1 -0
- package/dist/modules/contracts/ContractsModule.js +242 -0
- package/dist/modules/contracts/index.d.ts +6 -0
- package/dist/modules/contracts/index.d.ts.map +1 -0
- package/dist/modules/contracts/index.js +4 -0
- package/dist/modules/export/ExportModule.d.ts +346 -0
- package/dist/modules/export/ExportModule.d.ts.map +1 -0
- package/dist/modules/export/ExportModule.js +432 -0
- package/dist/modules/export/index.d.ts +3 -0
- package/dist/modules/export/index.d.ts.map +1 -0
- package/dist/modules/export/index.js +1 -0
- package/dist/modules/forecasting/ForecastingModule.d.ts +579 -0
- package/dist/modules/forecasting/ForecastingModule.d.ts.map +1 -0
- package/dist/modules/forecasting/ForecastingModule.js +310 -0
- package/dist/modules/forecasting/index.d.ts +3 -0
- package/dist/modules/forecasting/index.d.ts.map +1 -0
- package/dist/modules/forecasting/index.js +1 -0
- package/dist/modules/monitoring/MonitoringModule.d.ts +359 -0
- package/dist/modules/monitoring/MonitoringModule.d.ts.map +1 -0
- package/dist/modules/monitoring/MonitoringModule.js +483 -0
- package/dist/modules/monitoring/index.d.ts +3 -0
- package/dist/modules/monitoring/index.d.ts.map +1 -0
- package/dist/modules/monitoring/index.js +1 -0
- package/dist/modules/notifications/NotificationsModule.d.ts +336 -0
- package/dist/modules/notifications/NotificationsModule.d.ts.map +1 -0
- package/dist/modules/notifications/NotificationsModule.js +418 -0
- package/dist/modules/notifications/index.d.ts +3 -0
- package/dist/modules/notifications/index.d.ts.map +1 -0
- package/dist/modules/notifications/index.js +1 -0
- package/dist/modules/oracle/OracleModule.d.ts +110 -0
- package/dist/modules/oracle/OracleModule.d.ts.map +1 -0
- package/dist/modules/oracle/OracleModule.js +151 -0
- package/dist/modules/oracle/index.d.ts +6 -0
- package/dist/modules/oracle/index.d.ts.map +1 -0
- package/dist/modules/oracle/index.js +4 -0
- package/dist/modules/storage/S3Module.d.ts +377 -0
- package/dist/modules/storage/S3Module.d.ts.map +1 -0
- package/dist/modules/storage/S3Module.js +680 -0
- package/dist/modules/storage/StorageModule.d.ts +157 -0
- package/dist/modules/storage/StorageModule.d.ts.map +1 -0
- package/dist/modules/storage/StorageModule.js +302 -0
- package/dist/modules/storage/adapters/AdapterFactory.d.ts +100 -0
- package/dist/modules/storage/adapters/AdapterFactory.d.ts.map +1 -0
- package/dist/modules/storage/adapters/AdapterFactory.js +209 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.d.ts +94 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/FilecoinAdapter.js +263 -0
- package/dist/modules/storage/adapters/IStorageAdapter.d.ts +287 -0
- package/dist/modules/storage/adapters/IStorageAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/IStorageAdapter.js +81 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.d.ts +187 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.d.ts.map +1 -0
- package/dist/modules/storage/adapters/MultiTierAdapter.js +430 -0
- package/dist/modules/storage/adapters/index.d.ts +12 -0
- package/dist/modules/storage/adapters/index.d.ts.map +1 -0
- package/dist/modules/storage/adapters/index.js +12 -0
- package/dist/modules/storage/index.d.ts +16 -0
- package/dist/modules/storage/index.d.ts.map +1 -0
- package/dist/modules/storage/index.js +15 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.d.ts +227 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.d.ts.map +1 -0
- package/dist/modules/storage/tiering/AccessAnalyzer.js +367 -0
- package/dist/modules/storage/tiering/CostOptimizer.d.ts +248 -0
- package/dist/modules/storage/tiering/CostOptimizer.d.ts.map +1 -0
- package/dist/modules/storage/tiering/CostOptimizer.js +356 -0
- package/dist/modules/storage/tiering/MetadataStore.d.ts +287 -0
- package/dist/modules/storage/tiering/MetadataStore.d.ts.map +1 -0
- package/dist/modules/storage/tiering/MetadataStore.js +535 -0
- package/dist/modules/storage/tiering/TieringEngine.d.ts +237 -0
- package/dist/modules/storage/tiering/TieringEngine.d.ts.map +1 -0
- package/dist/modules/storage/tiering/TieringEngine.js +419 -0
- package/dist/modules/storage/tiering/example.d.ts +8 -0
- package/dist/modules/storage/tiering/example.d.ts.map +1 -0
- package/dist/modules/storage/tiering/example.js +250 -0
- package/dist/modules/storage/tiering/index.d.ts +17 -0
- package/dist/modules/storage/tiering/index.d.ts.map +1 -0
- package/dist/modules/storage/tiering/index.js +13 -0
- package/dist/modules/webhooks/WebhooksModule.d.ts +476 -0
- package/dist/modules/webhooks/WebhooksModule.d.ts.map +1 -0
- package/dist/modules/webhooks/WebhooksModule.js +359 -0
- package/dist/modules/webhooks/index.d.ts +3 -0
- package/dist/modules/webhooks/index.d.ts.map +1 -0
- package/dist/modules/webhooks/index.js +1 -0
- package/dist/modules/zk/ZKModule.d.ts +153 -0
- package/dist/modules/zk/ZKModule.d.ts.map +1 -0
- package/dist/modules/zk/ZKModule.js +262 -0
- package/dist/modules/zk/index.d.ts +7 -0
- package/dist/modules/zk/index.d.ts.map +1 -0
- package/dist/modules/zk/index.js +4 -0
- package/dist/thirdweb/BridgeClient.d.ts +228 -0
- package/dist/thirdweb/BridgeClient.d.ts.map +1 -0
- package/dist/thirdweb/BridgeClient.js +160 -0
- package/dist/thirdweb/EngineClient.d.ts +396 -0
- package/dist/thirdweb/EngineClient.d.ts.map +1 -0
- package/dist/thirdweb/EngineClient.js +386 -0
- package/dist/thirdweb/GatewayClient.d.ts +190 -0
- package/dist/thirdweb/GatewayClient.d.ts.map +1 -0
- package/dist/thirdweb/GatewayClient.js +257 -0
- package/dist/thirdweb/NebulaClient.d.ts +292 -0
- package/dist/thirdweb/NebulaClient.d.ts.map +1 -0
- package/dist/thirdweb/NebulaClient.js +180 -0
- package/dist/thirdweb/StorageClient.d.ts +445 -0
- package/dist/thirdweb/StorageClient.d.ts.map +1 -0
- package/dist/thirdweb/StorageClient.js +405 -0
- package/dist/thirdweb/ThirdwebWrapper.d.ts +236 -0
- package/dist/thirdweb/ThirdwebWrapper.d.ts.map +1 -0
- package/dist/thirdweb/ThirdwebWrapper.js +332 -0
- package/dist/thirdweb/index.d.ts +21 -0
- package/dist/thirdweb/index.d.ts.map +1 -0
- package/dist/thirdweb/index.js +28 -0
- package/dist/thirdweb/varity-chain.d.ts +48 -0
- package/dist/thirdweb/varity-chain.d.ts.map +1 -0
- package/dist/thirdweb/varity-chain.js +64 -0
- package/dist/thirdweb/x402Client.d.ts +319 -0
- package/dist/thirdweb/x402Client.d.ts.map +1 -0
- package/dist/thirdweb/x402Client.js +223 -0
- package/dist/tracking/gasTracker.d.ts +158 -0
- package/dist/tracking/gasTracker.d.ts.map +1 -0
- package/dist/tracking/gasTracker.js +227 -0
- package/dist/tracking/index.d.ts +10 -0
- package/dist/tracking/index.d.ts.map +1 -0
- package/dist/tracking/index.js +8 -0
- package/dist/tracking/types.d.ts +327 -0
- package/dist/tracking/types.d.ts.map +1 -0
- package/dist/tracking/types.js +8 -0
- package/dist/ui/components/ChartWidget.d.ts +36 -0
- package/dist/ui/components/ChartWidget.d.ts.map +1 -0
- package/dist/ui/components/ChartWidget.js +82 -0
- package/dist/ui/components/DashboardLayout.d.ts +41 -0
- package/dist/ui/components/DashboardLayout.d.ts.map +1 -0
- package/dist/ui/components/DashboardLayout.js +102 -0
- package/dist/ui/components/DataTable.d.ts +49 -0
- package/dist/ui/components/DataTable.d.ts.map +1 -0
- package/dist/ui/components/DataTable.js +96 -0
- package/dist/ui/components/EntityForm.d.ts +60 -0
- package/dist/ui/components/EntityForm.d.ts.map +1 -0
- package/dist/ui/components/EntityForm.js +182 -0
- package/dist/ui/components/KPICard.d.ts +29 -0
- package/dist/ui/components/KPICard.d.ts.map +1 -0
- package/dist/ui/components/KPICard.js +61 -0
- package/dist/ui/components/Modal.d.ts +34 -0
- package/dist/ui/components/Modal.d.ts.map +1 -0
- package/dist/ui/components/Modal.js +30 -0
- package/dist/ui/components/index.d.ts +18 -0
- package/dist/ui/components/index.d.ts.map +1 -0
- package/dist/ui/components/index.js +11 -0
- package/dist/validation/template-validator.d.ts +25 -0
- package/dist/validation/template-validator.d.ts.map +1 -0
- package/dist/validation/template-validator.js +305 -0
- package/package.json +102 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* thirdweb Storage Client
|
|
3
|
+
*
|
|
4
|
+
* Decentralized storage powered by IPFS and Arweave
|
|
5
|
+
* Seamless integration with thirdweb's storage infrastructure
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - IPFS storage with automatic pinning
|
|
9
|
+
* - Arweave permanent storage
|
|
10
|
+
* - Metadata management for NFTs
|
|
11
|
+
* - Batch uploads
|
|
12
|
+
* - Gateway URLs for fast access
|
|
13
|
+
* - Image optimization and resizing
|
|
14
|
+
*/
|
|
15
|
+
import { upload, download } from 'thirdweb/storage';
|
|
16
|
+
/**
|
|
17
|
+
* thirdweb Storage Client
|
|
18
|
+
*
|
|
19
|
+
* Decentralized storage for NFTs, metadata, and files
|
|
20
|
+
*/
|
|
21
|
+
export class StorageClient {
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this.client = config.client;
|
|
24
|
+
this.provider = config.provider || 'ipfs';
|
|
25
|
+
this.uploadOptions = config.uploadOptions || { pin: true };
|
|
26
|
+
this.analytics = config.analytics;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Upload a file to decentralized storage
|
|
30
|
+
*
|
|
31
|
+
* Uploads files to IPFS with automatic pinning via thirdweb infrastructure.
|
|
32
|
+
*
|
|
33
|
+
* @param file - File or Blob to upload
|
|
34
|
+
* @returns Upload result with IPFS URI and gateway URL
|
|
35
|
+
*
|
|
36
|
+
* @example Upload an image file
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { StorageClient } from '@varity-labs/sdk';
|
|
39
|
+
* import { createThirdwebClient } from 'thirdweb';
|
|
40
|
+
*
|
|
41
|
+
* const client = createThirdwebClient({
|
|
42
|
+
* clientId: process.env.THIRDWEB_CLIENT_ID
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* const storage = new StorageClient({ client });
|
|
46
|
+
*
|
|
47
|
+
* // Upload image from file input
|
|
48
|
+
* const file = document.querySelector('input[type="file"]').files[0];
|
|
49
|
+
* const result = await storage.uploadFile(file);
|
|
50
|
+
*
|
|
51
|
+
* console.log('IPFS URI:', result.uri);
|
|
52
|
+
* console.log('Gateway URL:', result.gatewayUrl);
|
|
53
|
+
* // IPFS URI: ipfs://QmXxx...
|
|
54
|
+
* // Gateway URL: https://gateway.thirdweb.com/ipfs/QmXxx...
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example Upload a Blob
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Create a text blob
|
|
60
|
+
* const blob = new Blob(['Hello, IPFS!'], { type: 'text/plain' });
|
|
61
|
+
* const result = await storage.uploadFile(blob);
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Upload and use in NFT
|
|
65
|
+
* ```typescript
|
|
66
|
+
* // Upload NFT image
|
|
67
|
+
* const imageResult = await storage.uploadFile(imageFile);
|
|
68
|
+
*
|
|
69
|
+
* // Create and upload metadata
|
|
70
|
+
* const metadata = {
|
|
71
|
+
* name: 'My NFT',
|
|
72
|
+
* description: 'An awesome NFT',
|
|
73
|
+
* image: imageResult.uri // Use IPFS URI
|
|
74
|
+
* };
|
|
75
|
+
*
|
|
76
|
+
* const metadataResult = await storage.uploadJSON(metadata);
|
|
77
|
+
* console.log('Token URI:', metadataResult.uri);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
async uploadFile(file) {
|
|
81
|
+
const startTime = Date.now();
|
|
82
|
+
// Convert Blob to File if needed
|
|
83
|
+
const fileToUpload = file instanceof File
|
|
84
|
+
? file
|
|
85
|
+
: new File([file], 'file', { type: file.type });
|
|
86
|
+
const uris = await upload({
|
|
87
|
+
client: this.client,
|
|
88
|
+
files: [fileToUpload],
|
|
89
|
+
});
|
|
90
|
+
// upload returns array of URIs
|
|
91
|
+
const uri = Array.isArray(uris) ? uris[0] : uris;
|
|
92
|
+
const result = {
|
|
93
|
+
uri,
|
|
94
|
+
gatewayUrl: this.getGatewayUrl(uri),
|
|
95
|
+
provider: this.provider,
|
|
96
|
+
size: file.size,
|
|
97
|
+
timestamp: new Date(),
|
|
98
|
+
};
|
|
99
|
+
// Track storage operation if analytics is configured
|
|
100
|
+
if (this.analytics) {
|
|
101
|
+
try {
|
|
102
|
+
const { getAnalyticsTracker } = await import('../analytics');
|
|
103
|
+
const tracker = getAnalyticsTracker();
|
|
104
|
+
tracker.trackStorage({
|
|
105
|
+
appId: this.analytics.appId,
|
|
106
|
+
developerId: this.analytics.developerId,
|
|
107
|
+
operation: 'upload',
|
|
108
|
+
bytes: file.size,
|
|
109
|
+
fileCount: 1
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Silently fail if analytics not initialized
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Upload JSON data
|
|
120
|
+
*/
|
|
121
|
+
async uploadJSON(data) {
|
|
122
|
+
const json = JSON.stringify(data);
|
|
123
|
+
const blob = new Blob([json], { type: 'application/json' });
|
|
124
|
+
return this.uploadFile(blob);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Upload NFT metadata
|
|
128
|
+
*
|
|
129
|
+
* Uploads NFT metadata JSON to IPFS following ERC-721/ERC-1155 standards.
|
|
130
|
+
*
|
|
131
|
+
* @param metadata - NFT metadata object
|
|
132
|
+
* @returns Upload result with metadata URI
|
|
133
|
+
*
|
|
134
|
+
* @example Basic NFT metadata
|
|
135
|
+
* ```typescript
|
|
136
|
+
* import { StorageClient } from '@varity-labs/sdk';
|
|
137
|
+
*
|
|
138
|
+
* const storage = new StorageClient({ client });
|
|
139
|
+
*
|
|
140
|
+
* const result = await storage.uploadMetadata({
|
|
141
|
+
* name: 'Cool NFT #1',
|
|
142
|
+
* description: 'A really cool NFT from my collection',
|
|
143
|
+
* image: 'ipfs://QmImageHash...'
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* console.log('Metadata URI:', result.uri);
|
|
147
|
+
* // Use this URI as tokenURI in your NFT contract
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example NFT with attributes
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const result = await storage.uploadMetadata({
|
|
153
|
+
* name: 'Character NFT #42',
|
|
154
|
+
* description: 'A unique game character',
|
|
155
|
+
* image: 'ipfs://QmImageHash...',
|
|
156
|
+
* attributes: [
|
|
157
|
+
* { trait_type: 'Level', value: 10 },
|
|
158
|
+
* { trait_type: 'Strength', value: 85 },
|
|
159
|
+
* { trait_type: 'Rarity', value: 'Epic' }
|
|
160
|
+
* ]
|
|
161
|
+
* });
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @example NFT with animation
|
|
165
|
+
* ```typescript
|
|
166
|
+
* // Upload video/animation
|
|
167
|
+
* const animationResult = await storage.uploadFile(videoFile);
|
|
168
|
+
*
|
|
169
|
+
* // Upload metadata with animation
|
|
170
|
+
* const result = await storage.uploadMetadata({
|
|
171
|
+
* name: 'Animated NFT',
|
|
172
|
+
* description: 'An NFT with animation',
|
|
173
|
+
* image: 'ipfs://QmPreviewImage...', // Preview image
|
|
174
|
+
* animation_url: animationResult.uri, // Video/animation
|
|
175
|
+
* external_url: 'https://myapp.com/nft/1',
|
|
176
|
+
* background_color: '000000'
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
async uploadMetadata(metadata) {
|
|
181
|
+
// Validate metadata structure
|
|
182
|
+
if (!metadata.name || !metadata.description || !metadata.image) {
|
|
183
|
+
throw new Error('NFT metadata must include name, description, and image');
|
|
184
|
+
}
|
|
185
|
+
return this.uploadJSON(metadata);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Upload multiple files in batch
|
|
189
|
+
*/
|
|
190
|
+
async uploadBatch(items) {
|
|
191
|
+
const startTime = Date.now();
|
|
192
|
+
const results = [];
|
|
193
|
+
let totalSize = 0;
|
|
194
|
+
for (const item of items) {
|
|
195
|
+
let file;
|
|
196
|
+
if (item.data instanceof File || item.data instanceof Blob) {
|
|
197
|
+
file = item.data;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
// Convert object to JSON blob
|
|
201
|
+
const json = JSON.stringify(item.data);
|
|
202
|
+
file = new Blob([json], { type: 'application/json' });
|
|
203
|
+
}
|
|
204
|
+
const result = await this.uploadFile(file);
|
|
205
|
+
results.push(result);
|
|
206
|
+
totalSize += result.size;
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
results,
|
|
210
|
+
totalSize,
|
|
211
|
+
duration: Date.now() - startTime,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Download a file from decentralized storage
|
|
216
|
+
*/
|
|
217
|
+
async downloadFile(uri, options) {
|
|
218
|
+
const response = await download({
|
|
219
|
+
client: this.client,
|
|
220
|
+
uri,
|
|
221
|
+
});
|
|
222
|
+
return response;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Download JSON data
|
|
226
|
+
*
|
|
227
|
+
* Downloads and parses JSON from IPFS/Arweave.
|
|
228
|
+
*
|
|
229
|
+
* @param uri - IPFS or Arweave URI
|
|
230
|
+
* @param options - Optional download configuration
|
|
231
|
+
* @returns Parsed JSON data
|
|
232
|
+
*
|
|
233
|
+
* @example Download NFT metadata
|
|
234
|
+
* ```typescript
|
|
235
|
+
* import { StorageClient } from '@varity-labs/sdk';
|
|
236
|
+
*
|
|
237
|
+
* const storage = new StorageClient({ client });
|
|
238
|
+
*
|
|
239
|
+
* // Get tokenURI from contract
|
|
240
|
+
* const tokenURI = await nftContract.tokenURI(tokenId);
|
|
241
|
+
*
|
|
242
|
+
* // Download and parse metadata
|
|
243
|
+
* const metadata = await storage.downloadJSON(tokenURI);
|
|
244
|
+
* console.log('NFT Name:', metadata.name);
|
|
245
|
+
* console.log('NFT Image:', metadata.image);
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @example With TypeScript type
|
|
249
|
+
* ```typescript
|
|
250
|
+
* interface MyMetadata {
|
|
251
|
+
* name: string;
|
|
252
|
+
* description: string;
|
|
253
|
+
* image: string;
|
|
254
|
+
* attributes: Array<{ trait_type: string; value: string | number }>;
|
|
255
|
+
* }
|
|
256
|
+
*
|
|
257
|
+
* const metadata = await storage.downloadJSON<MyMetadata>(uri);
|
|
258
|
+
* // TypeScript now knows metadata.attributes exists
|
|
259
|
+
* console.log('Traits:', metadata.attributes);
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
async downloadJSON(uri, options) {
|
|
263
|
+
const response = await this.downloadFile(uri, options);
|
|
264
|
+
return response.json();
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Get gateway URL for a URI
|
|
268
|
+
*/
|
|
269
|
+
getGatewayUrl(uri, options) {
|
|
270
|
+
// Extract CID from IPFS URI
|
|
271
|
+
const cid = uri.replace('ipfs://', '');
|
|
272
|
+
// Base gateway URL
|
|
273
|
+
let gatewayUrl = `https://gateway.thirdweb.com/ipfs/${cid}`;
|
|
274
|
+
// Add optimization parameters if provided
|
|
275
|
+
if (options) {
|
|
276
|
+
const params = new URLSearchParams();
|
|
277
|
+
if (options.width)
|
|
278
|
+
params.set('width', options.width.toString());
|
|
279
|
+
if (options.height)
|
|
280
|
+
params.set('height', options.height.toString());
|
|
281
|
+
if (options.quality)
|
|
282
|
+
params.set('quality', options.quality.toString());
|
|
283
|
+
if (options.format)
|
|
284
|
+
params.set('format', options.format);
|
|
285
|
+
const queryString = params.toString();
|
|
286
|
+
if (queryString) {
|
|
287
|
+
gatewayUrl += `?${queryString}`;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return gatewayUrl;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Pin a file to IPFS (ensure permanent availability)
|
|
294
|
+
*/
|
|
295
|
+
async pinFile(uri) {
|
|
296
|
+
// thirdweb automatically pins files uploaded through their service
|
|
297
|
+
// This method is provided for completeness but may not be necessary
|
|
298
|
+
console.log(`File ${uri} is automatically pinned by thirdweb`);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Unpin a file from IPFS
|
|
302
|
+
*/
|
|
303
|
+
async unpinFile(uri) {
|
|
304
|
+
console.warn('Unpinning is not supported through thirdweb gateway');
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Get file metadata
|
|
308
|
+
*/
|
|
309
|
+
async getMetadata(uri) {
|
|
310
|
+
const cid = uri.replace('ipfs://', '');
|
|
311
|
+
return {
|
|
312
|
+
cid,
|
|
313
|
+
pinned: true, // thirdweb automatically pins
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Upload a directory of files
|
|
318
|
+
*/
|
|
319
|
+
async uploadDirectory(files) {
|
|
320
|
+
const items = files.map(file => ({ data: file, filename: file.name }));
|
|
321
|
+
return this.uploadBatch(items);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Create and upload NFT collection metadata
|
|
325
|
+
*/
|
|
326
|
+
async uploadCollection(metadata) {
|
|
327
|
+
const results = await this.uploadBatch(metadata.map(data => ({ data })));
|
|
328
|
+
// Calculate base URI (common prefix)
|
|
329
|
+
const uris = results.results.map(r => r.uri);
|
|
330
|
+
const baseUri = uris[0].substring(0, uris[0].lastIndexOf('/'));
|
|
331
|
+
return {
|
|
332
|
+
metadataUris: uris,
|
|
333
|
+
baseUri,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Resolve IPFS URI to HTTP gateway URL
|
|
338
|
+
*/
|
|
339
|
+
static resolveUri(uri) {
|
|
340
|
+
if (uri.startsWith('ipfs://')) {
|
|
341
|
+
return `https://gateway.thirdweb.com/ipfs/${uri.replace('ipfs://', '')}`;
|
|
342
|
+
}
|
|
343
|
+
if (uri.startsWith('ar://')) {
|
|
344
|
+
return `https://arweave.net/${uri.replace('ar://', '')}`;
|
|
345
|
+
}
|
|
346
|
+
return uri;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Check if a URI is IPFS
|
|
350
|
+
*/
|
|
351
|
+
static isIPFS(uri) {
|
|
352
|
+
return uri.startsWith('ipfs://') || uri.startsWith('Qm') || uri.startsWith('baf');
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Check if a URI is Arweave
|
|
356
|
+
*/
|
|
357
|
+
static isArweave(uri) {
|
|
358
|
+
return uri.startsWith('ar://');
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Create Storage client instance
|
|
363
|
+
*
|
|
364
|
+
* Factory function for creating StorageClient instances.
|
|
365
|
+
*
|
|
366
|
+
* @param config - Storage configuration
|
|
367
|
+
* @returns Configured Storage client
|
|
368
|
+
*
|
|
369
|
+
* @example Basic setup
|
|
370
|
+
* ```typescript
|
|
371
|
+
* import { createStorageClient } from '@varity-labs/sdk';
|
|
372
|
+
* import { createThirdwebClient } from 'thirdweb';
|
|
373
|
+
*
|
|
374
|
+
* const client = createThirdwebClient({
|
|
375
|
+
* clientId: process.env.THIRDWEB_CLIENT_ID
|
|
376
|
+
* });
|
|
377
|
+
*
|
|
378
|
+
* const storage = createStorageClient({ client });
|
|
379
|
+
*
|
|
380
|
+
* // Now use storage client
|
|
381
|
+
* const result = await storage.uploadFile(file);
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* @example With Arweave provider
|
|
385
|
+
* ```typescript
|
|
386
|
+
* const storage = createStorageClient({
|
|
387
|
+
* client,
|
|
388
|
+
* provider: 'arweave' // Permanent storage
|
|
389
|
+
* });
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @example With custom upload options
|
|
393
|
+
* ```typescript
|
|
394
|
+
* const storage = createStorageClient({
|
|
395
|
+
* client,
|
|
396
|
+
* uploadOptions: {
|
|
397
|
+
* pin: true, // Auto-pin to IPFS
|
|
398
|
+
* timeout: 60000 // 60 second timeout
|
|
399
|
+
* }
|
|
400
|
+
* });
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
export function createStorageClient(config) {
|
|
404
|
+
return new StorageClient(config);
|
|
405
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thirdweb Wrapper for Varity SDK
|
|
3
|
+
*
|
|
4
|
+
* This wrapper provides Thirdweb SDK v5 functionality while maintaining
|
|
5
|
+
* 100% backwards compatibility with existing ethers.js v6 implementation.
|
|
6
|
+
*
|
|
7
|
+
* Pattern: Optional enhancement layer - does NOT break existing functionality
|
|
8
|
+
*/
|
|
9
|
+
import { type Chain } from 'thirdweb';
|
|
10
|
+
import { type Account } from 'thirdweb/wallets';
|
|
11
|
+
import { ethers } from 'ethers';
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for ThirdwebWrapper
|
|
14
|
+
*/
|
|
15
|
+
export interface ThirdwebWrapperConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Chain to use (defaults to Varity L3 Testnet)
|
|
18
|
+
* Can be a chain ID number or a Chain object from thirdweb/chains
|
|
19
|
+
*/
|
|
20
|
+
chain?: number | Chain;
|
|
21
|
+
/**
|
|
22
|
+
* RPC URL (optional - will use chain's default if not provided)
|
|
23
|
+
*/
|
|
24
|
+
rpcUrl?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Thirdweb Client ID
|
|
27
|
+
* Set via VARITY_THIRDWEB_CLIENT_ID environment variable
|
|
28
|
+
* Or use Varity Credential Proxy for automatic credentials
|
|
29
|
+
*/
|
|
30
|
+
clientId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional private key for wallet operations
|
|
33
|
+
*/
|
|
34
|
+
privateKey?: string;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use chain parameter instead
|
|
37
|
+
*/
|
|
38
|
+
chainId?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Contract deployment parameters
|
|
42
|
+
*/
|
|
43
|
+
export interface DeployContractParams {
|
|
44
|
+
name: string;
|
|
45
|
+
abi: any[];
|
|
46
|
+
bytecode: string;
|
|
47
|
+
constructorArgs?: any[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* ThirdwebWrapper Class
|
|
51
|
+
*
|
|
52
|
+
* Provides Thirdweb SDK capabilities with ethers.js fallback.
|
|
53
|
+
* All existing ethers.js functionality is preserved.
|
|
54
|
+
*/
|
|
55
|
+
export declare class ThirdwebWrapper {
|
|
56
|
+
private client;
|
|
57
|
+
private ethersProvider;
|
|
58
|
+
private chainId;
|
|
59
|
+
private account?;
|
|
60
|
+
private chain;
|
|
61
|
+
constructor(config: ThirdwebWrapperConfig);
|
|
62
|
+
/**
|
|
63
|
+
* Get a contract instance using Thirdweb
|
|
64
|
+
* @param address Contract address
|
|
65
|
+
* @returns Thirdweb contract instance
|
|
66
|
+
*/
|
|
67
|
+
getContract(address: string): Promise<Readonly<import("thirdweb").ContractOptions<[], `0x${string}`>>>;
|
|
68
|
+
/**
|
|
69
|
+
* Deploy a contract using Thirdweb
|
|
70
|
+
* @param params Deployment parameters
|
|
71
|
+
* @returns Deployed contract address
|
|
72
|
+
*/
|
|
73
|
+
deployContract(params: DeployContractParams): Promise<{
|
|
74
|
+
address: string;
|
|
75
|
+
deployed: boolean;
|
|
76
|
+
method: string;
|
|
77
|
+
transactionHash: string;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Upload data to IPFS using Thirdweb Storage
|
|
81
|
+
* @param data Data to upload (can be JSON, File, or any supported type)
|
|
82
|
+
* @returns IPFS URI
|
|
83
|
+
*/
|
|
84
|
+
uploadToIPFS(data: any): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Download data from IPFS using Thirdweb Storage
|
|
87
|
+
* @param uri IPFS URI
|
|
88
|
+
* @returns Downloaded data
|
|
89
|
+
*/
|
|
90
|
+
downloadFromIPFS(uri: string): Promise<Response>;
|
|
91
|
+
/**
|
|
92
|
+
* Get the ethers.js provider (backwards compatibility)
|
|
93
|
+
* @returns Ethers JsonRpcProvider
|
|
94
|
+
*/
|
|
95
|
+
getEthersProvider(): ethers.JsonRpcProvider;
|
|
96
|
+
/**
|
|
97
|
+
* Get a contract instance using ethers.js (backwards compatibility)
|
|
98
|
+
* @param address Contract address
|
|
99
|
+
* @param abi Contract ABI
|
|
100
|
+
* @returns Ethers Contract instance
|
|
101
|
+
*/
|
|
102
|
+
getContractWithEthers(address: string, abi: any[]): Promise<ethers.Contract>;
|
|
103
|
+
/**
|
|
104
|
+
* Deploy a contract using ethers.js (backwards compatibility)
|
|
105
|
+
* @param params Deployment parameters
|
|
106
|
+
* @returns Deployment result
|
|
107
|
+
*/
|
|
108
|
+
deployContractWithEthers(params: DeployContractParams): Promise<{
|
|
109
|
+
address: string;
|
|
110
|
+
deployed: boolean;
|
|
111
|
+
method: string;
|
|
112
|
+
transactionHash: string | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Get the Thirdweb client instance
|
|
116
|
+
* @returns Thirdweb client
|
|
117
|
+
*/
|
|
118
|
+
getClient(): import("thirdweb").ThirdwebClient;
|
|
119
|
+
/**
|
|
120
|
+
* Get the Thirdweb account (if configured)
|
|
121
|
+
* @returns Thirdweb account or undefined
|
|
122
|
+
*/
|
|
123
|
+
getAccount(): Account | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get the chain configuration
|
|
126
|
+
* @returns Varity chain definition
|
|
127
|
+
*/
|
|
128
|
+
getChain(): Readonly<import("thirdweb/chains").ChainOptions & {
|
|
129
|
+
rpc: string;
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* Get the chain ID
|
|
133
|
+
* @returns Chain ID (33529)
|
|
134
|
+
*/
|
|
135
|
+
getChainId(): number;
|
|
136
|
+
/**
|
|
137
|
+
* Check if Thirdweb account is configured
|
|
138
|
+
* @returns True if account is available
|
|
139
|
+
*/
|
|
140
|
+
hasAccount(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Deploy contract with automatic fallback
|
|
143
|
+
* Tries Thirdweb first, falls back to ethers.js on error
|
|
144
|
+
* @param params Deployment parameters
|
|
145
|
+
* @returns Deployment result
|
|
146
|
+
*/
|
|
147
|
+
deployWithFallback(params: DeployContractParams): Promise<{
|
|
148
|
+
address: string;
|
|
149
|
+
deployed: boolean;
|
|
150
|
+
method: string;
|
|
151
|
+
transactionHash: string | undefined;
|
|
152
|
+
}>;
|
|
153
|
+
/**
|
|
154
|
+
* Get contract events
|
|
155
|
+
* @param params Event query parameters
|
|
156
|
+
* @returns Contract events
|
|
157
|
+
*/
|
|
158
|
+
getContractEvents(params: {
|
|
159
|
+
contract: any;
|
|
160
|
+
fromBlock?: number;
|
|
161
|
+
toBlock?: number | 'latest';
|
|
162
|
+
eventName?: string;
|
|
163
|
+
}): Promise<ethers.Log[]>;
|
|
164
|
+
/**
|
|
165
|
+
* Get block information
|
|
166
|
+
* @param blockNumber Block number or 'latest'
|
|
167
|
+
* @returns Block information
|
|
168
|
+
*/
|
|
169
|
+
getBlock(blockNumber: string | number): Promise<ethers.Block | null>;
|
|
170
|
+
/**
|
|
171
|
+
* Get transaction information
|
|
172
|
+
* @param hash Transaction hash
|
|
173
|
+
* @returns Transaction information
|
|
174
|
+
*/
|
|
175
|
+
getTransaction(hash: string): Promise<ethers.TransactionResponse | null>;
|
|
176
|
+
/**
|
|
177
|
+
* Get current gas price
|
|
178
|
+
* @returns Gas price in wei
|
|
179
|
+
*/
|
|
180
|
+
getGasPrice(): Promise<bigint | null>;
|
|
181
|
+
/**
|
|
182
|
+
* Get wallet balance
|
|
183
|
+
* @param address Wallet address
|
|
184
|
+
* @returns Balance in wei
|
|
185
|
+
*/
|
|
186
|
+
getBalance(address: string): Promise<bigint>;
|
|
187
|
+
/**
|
|
188
|
+
* Get NFTs for a wallet
|
|
189
|
+
* @param address Wallet address
|
|
190
|
+
* @param options Query options
|
|
191
|
+
* @returns NFT list
|
|
192
|
+
*/
|
|
193
|
+
getNFTs(address: string, options?: {
|
|
194
|
+
limit?: number;
|
|
195
|
+
offset?: number;
|
|
196
|
+
}): Promise<never[]>;
|
|
197
|
+
/**
|
|
198
|
+
* Get transaction history for a wallet
|
|
199
|
+
* @param address Wallet address
|
|
200
|
+
* @param options Query options
|
|
201
|
+
* @returns Transaction history
|
|
202
|
+
*/
|
|
203
|
+
getTransactionHistory(address: string, options?: {
|
|
204
|
+
limit?: number;
|
|
205
|
+
offset?: number;
|
|
206
|
+
}): Promise<never[]>;
|
|
207
|
+
/**
|
|
208
|
+
* Get token balances for a wallet
|
|
209
|
+
* @param address Wallet address
|
|
210
|
+
* @returns Token balances
|
|
211
|
+
*/
|
|
212
|
+
getTokenBalances(address: string): Promise<never[]>;
|
|
213
|
+
/**
|
|
214
|
+
* Send transaction
|
|
215
|
+
* @param params Transaction parameters
|
|
216
|
+
* @returns Transaction result
|
|
217
|
+
*/
|
|
218
|
+
sendTransaction(params: {
|
|
219
|
+
from: string;
|
|
220
|
+
to: string;
|
|
221
|
+
amount: string;
|
|
222
|
+
token?: string;
|
|
223
|
+
}): Promise<{
|
|
224
|
+
transactionHash: string;
|
|
225
|
+
from: string;
|
|
226
|
+
to: string;
|
|
227
|
+
amount: string;
|
|
228
|
+
}>;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Factory function to create ThirdwebWrapper instance
|
|
232
|
+
* @param config Configuration options
|
|
233
|
+
* @returns ThirdwebWrapper instance
|
|
234
|
+
*/
|
|
235
|
+
export declare function createThirdwebWrapper(config: ThirdwebWrapperConfig): ThirdwebWrapper;
|
|
236
|
+
//# sourceMappingURL=ThirdwebWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdwebWrapper.d.ts","sourceRoot":"","sources":["../../src/thirdweb/ThirdwebWrapper.ts"],"names":[],"mappings":"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"}
|