droplinked-web3-kit 0.0.2 → 0.0.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.
- package/README.md +143 -370
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,400 +1,173 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Web3 Package use cases via examples
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## How to use Login Via Wallet
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Normal Login
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```js
|
|
8
|
+
// Create web3 object
|
|
9
|
+
const web3 = new DropWeb3(Network.TESTNET, accessToken);
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
│
|
|
15
|
-
├───chains
|
|
16
|
-
│ │ chain-provider.ts
|
|
17
|
-
│ │ README.md
|
|
18
|
-
│ │
|
|
19
|
-
│ ├───dto
|
|
20
|
-
│ │ │ chains.ts
|
|
21
|
-
│ │ │
|
|
22
|
-
│ │ ├───configs
|
|
23
|
-
│ │ │ chain.config.ts
|
|
24
|
-
│ │ │ chainlink-addresses.ts
|
|
25
|
-
│ │ │ README.md
|
|
26
|
-
│ │ │ web3-config.ts
|
|
27
|
-
│ │ │
|
|
28
|
-
│ │ ├───constants
|
|
29
|
-
│ │ │ airdrop-abi.ts
|
|
30
|
-
│ │ │ chain-abis.ts
|
|
31
|
-
│ │ │ chain-constants.ts
|
|
32
|
-
│ │ │ chain-structs.ts
|
|
33
|
-
│ │ │ README.md
|
|
34
|
-
│ │ │
|
|
35
|
-
│ │ ├───errors
|
|
36
|
-
│ │ │ chain-errors.ts
|
|
37
|
-
│ │ │
|
|
38
|
-
│ │ └───interfaces
|
|
39
|
-
│ │ airdrop-token.interface.ts
|
|
40
|
-
│ │ chain-payment.interface.ts
|
|
41
|
-
│ │ chain-provider.interface.ts
|
|
42
|
-
│ │ claim-nft-inputs.ts
|
|
43
|
-
│ │ deploy-shop.interface.ts
|
|
44
|
-
│ │ login-result.interface.ts
|
|
45
|
-
│ │ modal-interface.interface.ts
|
|
46
|
-
│ │ payment-interface.ts
|
|
47
|
-
│ │ record-web3-product.interface.ts
|
|
48
|
-
│ │ web3-context.interface.ts
|
|
49
|
-
│ │
|
|
50
|
-
│ └───providers
|
|
51
|
-
│ ├───evm
|
|
52
|
-
│ │ evm-affiliate.ts
|
|
53
|
-
│ │ evm-airdrop.ts
|
|
54
|
-
│ │ evm-claim-nfts.ts
|
|
55
|
-
│ │ evm-constants.ts
|
|
56
|
-
│ │ evm-deploy-shop.ts
|
|
57
|
-
│ │ evm-login.ts
|
|
58
|
-
│ │ evm-payments.ts
|
|
59
|
-
│ │ evm-provider.ts
|
|
60
|
-
│ │ evm-publish.ts
|
|
61
|
-
│ │ evm-record.ts
|
|
62
|
-
│ │ evm.helpers.ts
|
|
63
|
-
│ │ README.md
|
|
64
|
-
│ │
|
|
65
|
-
│ ├───solana
|
|
66
|
-
│ │ README.md
|
|
67
|
-
│ │ solana-provider.ts
|
|
68
|
-
│ │
|
|
69
|
-
│ └───unstoppable
|
|
70
|
-
│ unstoppable-provider.ts
|
|
71
|
-
│
|
|
72
|
-
└───wallet-providers
|
|
73
|
-
appkit.ts
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## 1. High-Level Architecture
|
|
80
|
-
|
|
81
|
-
At the heart of this library is a **factory** class called `DropWeb3`, which, given a chosen network (Testnet, Mainnet, etc.), exposes a **single entry point** (`web3Instance`) to obtain a configured provider that implements the `IChainProvider` interface. Each provider (e.g., `EVMProvider`, `SolanaProvider`, `UnstoppableProvider`) encapsulates all chain-specific logic, from wallet connection through contract interaction and transaction management.
|
|
82
|
-
|
|
83
|
-
The design follows the **Strategy pattern**: calling code never directly references blockchain-specific classes; it only relies on the uniform methods defined by `IChainProvider`. This ensures that adding support for new chains or networks requires zero changes to application-level logic.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## 2. Core Interfaces and Types
|
|
88
|
-
|
|
89
|
-
### 2.1 IChainProvider Interface
|
|
90
|
-
|
|
91
|
-
Defines the contract every chain provider must fulfill. Key methods:
|
|
92
|
-
|
|
93
|
-
- **`setAxiosInstance(axiosInstance: KyInstance)`**: Inject a custom HTTP client for backend calls (e.g., metadata upload, address lookup).
|
|
94
|
-
- **`walletLogin()`**: Trigger user login via wallet, returning `{ address, signature, nonce, timestamp }`.
|
|
95
|
-
- **`deployShop(shopDetails: IDeployShop)`**: Deploy a shop smart contract, returning addresses and constructor args.
|
|
96
|
-
- **`recordProduct(productData: IProductDetails, skuData: ISKUDetails[])`**: Mint NFTs and register product metadata with your shop contract.
|
|
97
|
-
- **`publishRequest(productId: Uint256, shopAddress: EthAddress)`**: Request affiliate permission to publish a product.
|
|
98
|
-
- **`approveRequest(requestId: Uint256, shopAddress: EthAddress)`** / **`disapproveRequest(...)`**: Approve or disapprove affiliate requests.
|
|
99
|
-
- **`payment(data: IPaymentInputs)`**: Execute a payment, handling token approvals and transfers.
|
|
100
|
-
- **`customPayment(data: IChainPayment)`**: Low-level payment via proxy contracts.
|
|
101
|
-
- **`paymentWithToken(receiver: string, amount: number, tokenAddress: string)`**: Direct token transfer.
|
|
102
|
-
- **`claimNFTs(data: ClaimNFTInputs)`**: Process NFT claim transactions.
|
|
103
|
-
- **`executeAirdrop(airdropId: string)`**: Run batch airdrops of NFTs or tokens.
|
|
104
|
-
- **Chaining setters**: `setAddress`, `setWallet`, `setModal`, `setNFTContractAddress`, `setShopContractAddress`, `setWalletModal` – provide a *fluent API* to configure context before invoking actions.
|
|
105
|
-
- **`disconnect()`**: Cleanly disconnect from the wallet or provider.
|
|
106
|
-
|
|
107
|
-
All methods return Promises, and setter methods return `this` for easy chaining.
|
|
108
|
-
|
|
109
|
-
### 2.2 Web3ChainConfig & Web3Actions
|
|
110
|
-
|
|
111
|
-
Controls how `DropWeb3.web3Instance()` configures your provider:
|
|
112
|
-
|
|
113
|
-
- **`method: Web3Actions`**: One of `LOGIN`, `DEPLOY`, `RECORD_AFFILIATE`, `PAYMENT`, `CLAIM`, `AIRDROP`.
|
|
114
|
-
- **`chain: Chain`** and **`network: Network`**: Specify which blockchain and sub-network to target.
|
|
115
|
-
- **`preferredWallet: ChainWallet | ChainWallet[]`**: Wallet(s) to prompt (e.g., MetaMask, Phantom, Unstoppable Domains).
|
|
116
|
-
- **`userAddress`, `nftContractAddress`, `shopContractAddress`**: Provide runtime data required by certain actions.
|
|
117
|
-
- **`modalInterface`**: Inject a UI layer for status, confirmations, or error dialogues.
|
|
118
|
-
|
|
119
|
-
The factory interprets these configs to instantiate and configure the correct provider.
|
|
120
|
-
|
|
121
|
-
### 2.3 DroplinkedChainConfig
|
|
122
|
-
|
|
123
|
-
A lightweight internal structure used by helper functions. Contains:
|
|
124
|
-
|
|
125
|
-
- **`provider: ethers.BrowserProvider`** – low-level RPC connection.
|
|
126
|
-
- **`chain: Chain`, `network: Network`, `userAddress: EthAddress`** – routing details.
|
|
127
|
-
- **`axiosInstance: KyInstance`** – API client.
|
|
128
|
-
- **`modalInterface: ModalInterface`** – user feedback hook.
|
|
129
|
-
- **`gasPredictable: boolean`** – hint for gas estimation strategies.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## 3. The DropWeb3 Factory
|
|
134
|
-
|
|
135
|
-
Implemented in `chain-provider.ts`, the `DropWeb3` class:
|
|
11
|
+
// create the chain provider
|
|
12
|
+
const chainProvider = await web3.web3Instance({
|
|
13
|
+
method: Web3Actions.LOGIN,
|
|
14
|
+
preferredWallet: ChainWallet.Metamask,
|
|
15
|
+
});
|
|
136
16
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
3. **`web3Instance(config: Web3ChainConfig)`**:
|
|
140
|
-
- Validates that an implementation exists for the requested chain/network.
|
|
141
|
-
- Retrieves or constructs a modal via `AppKitProvider`.
|
|
142
|
-
- Calls chaining setters on the provider instance: `.setAddress()`, `.setWallet()`, `.setModal()`, `.setAxiosInstance()`.
|
|
143
|
-
- Returns the configured `IChainProvider`.
|
|
17
|
+
// Login via wallet
|
|
18
|
+
const loginData = await chainProvider.walletLogin();
|
|
144
19
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
userAddress: '0xabc...'
|
|
20
|
+
// Log the results
|
|
21
|
+
console.log({
|
|
22
|
+
address: loginData.address,
|
|
23
|
+
date: loginData.date,
|
|
24
|
+
none: loginData.nonce,
|
|
25
|
+
signature: loginData.signature,
|
|
152
26
|
});
|
|
153
27
|
```
|
|
154
28
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
## 4. Implementation: EVMProvider
|
|
158
|
-
|
|
159
|
-
Located at `lib/chains/providers/evm/evm-provider.ts`, `EVMProvider`:
|
|
160
|
-
|
|
161
|
-
### 4.1 Construction & Configuration
|
|
162
|
-
|
|
163
|
-
- **Constructor**
|
|
164
|
-
```ts
|
|
165
|
-
constructor(chain: Chain, network: Network, gasPredictable: boolean) { … }
|
|
166
|
-
```
|
|
167
|
-
- Initializes `chain`, `network`, `gasPredictable`.
|
|
168
|
-
- Sets default `axiosInstance`, `modalInterface`, and `address = ZERO_ADDRESS`.
|
|
169
|
-
|
|
170
|
-
- **Chaining Setters**: `setAxiosInstance()`, `setWalletModal()`, `setNFTContractAddress()`, `setShopContractAddress()`, `setWallet()`, `setModal()`, `setAddress()`.
|
|
171
|
-
|
|
172
|
-
### 4.2 Connection Management
|
|
173
|
-
|
|
174
|
-
- **`getEthersProvider()`**:
|
|
175
|
-
1. Checks `modal.getProvider('eip155')`.
|
|
176
|
-
2. Uses `modal.connect('eip155')` if needed.
|
|
177
|
-
3. Returns `ethers.BrowserProvider`.
|
|
178
|
-
|
|
179
|
-
- **`disconnect()`**: Calls `modal.disconnect('eip155')` until none remain.
|
|
180
|
-
|
|
181
|
-
### 4.3 Core Feature Methods
|
|
182
|
-
|
|
183
|
-
#### 4.3.1 Wallet Login
|
|
184
|
-
1. `getEthersProvider()`
|
|
185
|
-
2. Request accounts.
|
|
186
|
-
3. Switch or add chain as needed.
|
|
187
|
-
4. Request SKALE fuel if applicable.
|
|
188
|
-
5. Fetch nonce, sign message.
|
|
189
|
-
6. Return `{ address, signature, nonce, timestamp }`.
|
|
190
|
-
|
|
191
|
-
#### 4.3.2 Shop Deployment
|
|
192
|
-
Delegates to `deployEVMShop()`:
|
|
193
|
-
1. Build constructor args.
|
|
194
|
-
2. Fetch bytecode via `getShopByteCode()`.
|
|
195
|
-
3. Estimate gas and deploy via Ethers.js.
|
|
196
|
-
4. Wait for `ShopDeployed` event.
|
|
197
|
-
5. Return `{ shopAddress, metadataURI }`.
|
|
198
|
-
|
|
199
|
-
#### 4.3.3 Product Recording (NFT Minting)
|
|
200
|
-
Calls `recordProduct()`:
|
|
201
|
-
1. Upload metadata for each SKU.
|
|
202
|
-
2. Prepare data: `{ tokenURI, quantity, price }`.
|
|
203
|
-
3. Batch mint NFTs.
|
|
204
|
-
4. Return `{ transactionHash, mintedIds }`.
|
|
29
|
+
### Unstoppable Login
|
|
205
30
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
- **approveRequest()/disapproveRequest()**: Executes `approve(requestId)` or `disapprove(requestId)` and handles common errors.
|
|
31
|
+
```js
|
|
32
|
+
const web3 = new DropWeb3(Network.TESTNET, accessToken);
|
|
209
33
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
#### 4.3.6 NFT Claiming
|
|
216
|
-
`claimNFTs()` calls bulk `claimPurchase()` on shop contract; returns transaction hash.
|
|
217
|
-
|
|
218
|
-
#### 4.3.7 Airdrops
|
|
219
|
-
`executeAirdrop()`:
|
|
220
|
-
1. Fetch recipients and token lists.
|
|
221
|
-
2. Batch-call `airdropTokens()`.
|
|
222
|
-
3. Return list of transaction hashes.
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## 5. Supporting Modules & Utilities
|
|
227
|
-
|
|
228
|
-
### 5.1 Constants & Structs
|
|
229
|
-
- **`chain-constants.ts`**: ZERO_ADDRESS, network IDs.
|
|
230
|
-
- **`chain-structs.ts`**: Types (`EthAddress`, `Uint256`, etc.)
|
|
231
|
-
|
|
232
|
-
### 5.2 ABI Definitions
|
|
233
|
-
- Stored in `chain-abis/`.
|
|
234
|
-
- Helper getters like `getERC20TokenTransferABI()`.
|
|
235
|
-
|
|
236
|
-
### 5.3 Chain Config Fetchers
|
|
237
|
-
In `chain.config.ts`:
|
|
238
|
-
- `getDeployerAddress()`, `getProxyAddress()`, `getFundsProxy()`, `getAirdropAddress()`.
|
|
34
|
+
const chainProvider = await web3.web3Instance({
|
|
35
|
+
method: Web3Actions.LOGIN,
|
|
36
|
+
preferredWallet: ChainWallet.UnstoppableDomains,
|
|
37
|
+
});
|
|
239
38
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
- Payment errors: `InsufficientBalanceException`, etc.
|
|
39
|
+
const loginData = await chainProvider.unstoppableLogin(
|
|
40
|
+
'de81c772-62be-45ed-8d0b-103abfec2ab8', // <-- UDKey
|
|
41
|
+
window.location.origin
|
|
42
|
+
);
|
|
245
43
|
|
|
246
|
-
|
|
44
|
+
console.log({ loginData });
|
|
45
|
+
```
|
|
247
46
|
|
|
248
|
-
##
|
|
47
|
+
## Record Procedure
|
|
249
48
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
49
|
+
```typescript
|
|
50
|
+
const blockchain = "POLYGON"; // The blockchain where the product will be recorded
|
|
51
|
+
const productId = "your-product-id"; // The ID of the product to be recorded
|
|
52
|
+
const accountAddress = "user-wallet-address"; // The user's wallet address, can be empty string to prompt connection
|
|
53
|
+
const shopId = "your-shop-id"; // The ID of the shop where the product will be recorded
|
|
255
54
|
|
|
256
|
-
|
|
55
|
+
const web3 = new DropWeb3(
|
|
56
|
+
appDevelopment ? Network.TESTNET : Network.MAINNET,
|
|
57
|
+
shopId
|
|
58
|
+
);
|
|
257
59
|
|
|
258
|
-
|
|
60
|
+
const provider = await web3.web3Instance({
|
|
61
|
+
method: Web3Actions.RECORD,
|
|
62
|
+
chain: Chain[blockchain],
|
|
63
|
+
preferredWallet: ChainWallet.Metamask,
|
|
64
|
+
userAddress: accountAddress, // If the userAddress field is empty, it will prompt the user to connect their wallet first
|
|
65
|
+
});
|
|
259
66
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
import { DropWeb3 } from './lib/chains/chain-provider';
|
|
263
|
-
import { Network, Web3Actions, Chain, ChainWallet } from './lib/chains/dto/configs/web3-config';
|
|
67
|
+
let record: RecordResponse;
|
|
68
|
+
record = await provider.recordProduct(productId);
|
|
264
69
|
|
|
265
|
-
|
|
70
|
+
return record;
|
|
266
71
|
```
|
|
267
72
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
73
|
+
### Custom errors
|
|
74
|
+
|
|
75
|
+
- `ChainNotImplementedException`: when trying to record on a chain which is not implemented yet.
|
|
76
|
+
- `Unauthorized`: The user is not the owner of the shop contract to record products on it.
|
|
77
|
+
- `FieldNotFound`: the `nftContractAddress` or `shopContractAddress` fields are not set for the recording shop.
|
|
78
|
+
- `Web3CallbackFailed`: The callback to web3 services after recording failed.
|
|
79
|
+
- `MetadataUploadFailedException`: The upload of metadata of SKUs failed.
|
|
80
|
+
- `WalletNotFoundException`: The preferred wallet does not exist (must redirect user to wallet installation page).
|
|
81
|
+
- `AccountAccessDeniedException`: The user did not grant access to their wallet when connecting.
|
|
82
|
+
- `NoAccountsFoundException`: The user did not grant access to any of their accounts when connecting.
|
|
83
|
+
- `SignatureRequestDeniedException`: The user denied a signature request.
|
|
84
|
+
- `ChainSwitchException`: Can not switch to the correct chain in the user's wallet.
|
|
85
|
+
- `UserDeniedException`: User denied a sign transaction request.
|
|
86
|
+
|
|
87
|
+
You can import these errors and check if any of them happens during a record process.
|
|
88
|
+
|
|
89
|
+
## Payment Procedure
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
import {
|
|
93
|
+
Chain,
|
|
94
|
+
ChainWallet,
|
|
95
|
+
DropWeb3,
|
|
96
|
+
Network,
|
|
97
|
+
PaymentTokens,
|
|
98
|
+
Web3Actions,
|
|
99
|
+
} from 'droplinked-web3-kit';
|
|
100
|
+
|
|
101
|
+
const shopId = '66d47d965744cb21dac659ab';
|
|
102
|
+
const orderId = '5a4fc3e56134cb23cba014dc';
|
|
103
|
+
const paymentMethod = 'USDC';
|
|
104
|
+
const paymentType = 'BINANCE';
|
|
105
|
+
|
|
106
|
+
// Create Web3 Object
|
|
107
|
+
const web3 = new DropWeb3(Network.TESTNET, shopId);
|
|
108
|
+
|
|
109
|
+
// Get a provider instance
|
|
110
|
+
const instance = await web3.web3Instance({
|
|
111
|
+
method: Web3Actions.PAYMENT,
|
|
112
|
+
chain: Chain[paymentType],
|
|
113
|
+
preferredWallet: ChainWallet.Metamask,
|
|
114
|
+
userAddress: '0xYourWalletAddressHere', // <-- This can be fetched by using the login method, also you can pass empty string and the package will ask the user to connect their wallet
|
|
273
115
|
});
|
|
274
|
-
const { address, signature } = await loginProvider.walletLogin();
|
|
275
|
-
```
|
|
276
116
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
preferredWallet: preferredWallets,
|
|
283
|
-
chain: Chain.BASE,
|
|
284
|
-
userAddress: "0x...",
|
|
117
|
+
// Call the payment method
|
|
118
|
+
const result = await instance.payment({
|
|
119
|
+
orderID: orderId,
|
|
120
|
+
paymentToken: PaymentTokens[paymentMethod],
|
|
121
|
+
paymentType: Chain[paymentType],
|
|
285
122
|
});
|
|
286
|
-
const shop = chainInstance.deployShop({
|
|
287
|
-
shopAddress: "...",
|
|
288
|
-
shopDescription: "...",
|
|
289
|
-
shopLogo: "...",
|
|
290
|
-
shopName: "..."
|
|
291
|
-
})
|
|
292
|
-
console.log(shop.deployedNFTAddress, shop.deployedShopAddress, shop.transactionHash);
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
## 8. Extending to New Chains
|
|
299
|
-
|
|
300
|
-
1. Create `NewChainProvider implements IChainProvider` under `lib/chains/providers/newchain/`.
|
|
301
|
-
2. Implement all interface methods using the chain's SDK.
|
|
302
|
-
3. Add to `chainMapping` in `chain-provider.ts`.
|
|
303
|
-
4. Include any new ABI or config files.
|
|
304
|
-
5. Write integration tests covering all methods.
|
|
305
|
-
|
|
306
|
-
---
|
|
307
|
-
|
|
308
|
-
## 9. Best Practices & Recommendations
|
|
309
123
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
---
|
|
318
|
-
|
|
319
|
-
*Welcome aboard! Use this guide as your roadmap to explore, debug, and extend the DropLinked integration library.*
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
## 10. Project Entry Points
|
|
323
|
-
|
|
324
|
-
### 10.1 `index.ts`
|
|
325
|
-
|
|
326
|
-
The entry point of the library re-exports core modules to simplify imports:
|
|
327
|
-
|
|
328
|
-
```ts
|
|
329
|
-
// index.ts
|
|
330
|
-
export * from './lib/web3';
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
This allows consumers to import everything via:
|
|
334
|
-
|
|
335
|
-
```ts
|
|
336
|
-
import { DropWeb3, Web3Actions, Chain, Network } from 'droplinked-sdk';
|
|
124
|
+
// Log the results
|
|
125
|
+
console.log({
|
|
126
|
+
orderID: result.orderID,
|
|
127
|
+
cryptoAmount: result.cryptoAmount,
|
|
128
|
+
transactionHash: result.transactionHash,
|
|
129
|
+
transactionId: result.transactionId,
|
|
130
|
+
});
|
|
337
131
|
```
|
|
338
132
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
export * from './chains/dto/interfaces/record-web3-product.interface';
|
|
359
|
-
export * from './chains/dto/interfaces/web3-context.interface';
|
|
360
|
-
export { ZERO_ADDRESS };
|
|
133
|
+
List of Chains and Payment Tokens supported can be found here:
|
|
134
|
+
|
|
135
|
+
Payment Tokens:
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
export declare enum PaymentTokens {
|
|
139
|
+
ETH = "ETH",
|
|
140
|
+
RBNT = "RBNT",
|
|
141
|
+
SOL = "SOL",
|
|
142
|
+
USDC = "USDC",
|
|
143
|
+
USDT = "USDT",
|
|
144
|
+
MEW = "MEW",
|
|
145
|
+
BNB = "BNB",
|
|
146
|
+
MATIC = "MATIC",
|
|
147
|
+
CSPR = "CSPR",
|
|
148
|
+
PARAM = "PARAM",
|
|
149
|
+
BDC = "BDC",
|
|
150
|
+
BTC = "BTC"
|
|
151
|
+
}
|
|
361
152
|
```
|
|
362
153
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
154
|
+
Chains:
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
export declare enum Chain {
|
|
158
|
+
CASPER = "CASPER",
|
|
159
|
+
POLYGON = "POLYGON",
|
|
160
|
+
BINANCE = "BINANCE",
|
|
161
|
+
STACKS = "STACKS",
|
|
162
|
+
XRPLSIDECHAIN = "XRPLSIDECHAIN",
|
|
163
|
+
NEAR = "NEAR",
|
|
164
|
+
SKALE = "SKALE",
|
|
165
|
+
BASE = "BASE",
|
|
166
|
+
LINEA = "LINEA",
|
|
167
|
+
ETH = "ETH",
|
|
168
|
+
SOLANA = "SOLANA",
|
|
169
|
+
REDBELLY = "REDBELLY",
|
|
170
|
+
UNSTOPPABLE = "UNSTOPPABLE",
|
|
171
|
+
BITLAYER = "BITLAYER"
|
|
172
|
+
}
|
|
369
173
|
```
|
|
370
|
-
lib/chains/dto
|
|
371
|
-
├── chains.ts
|
|
372
|
-
├── configs
|
|
373
|
-
│ ├── chain.config.ts
|
|
374
|
-
│ └── web3-config.ts
|
|
375
|
-
├── constants
|
|
376
|
-
│ ├── chain-constants.ts
|
|
377
|
-
│ └── chain-structs.ts
|
|
378
|
-
├── errors
|
|
379
|
-
│ └── chain-errors.ts
|
|
380
|
-
└── interfaces
|
|
381
|
-
├── airdrop-token.interface.ts
|
|
382
|
-
├── chain-provider.interface.ts
|
|
383
|
-
├── chain-payment.interface.ts
|
|
384
|
-
├── claim-nft-inputs.ts
|
|
385
|
-
├── deploy-shop.interface.ts
|
|
386
|
-
├── modal-interface.interface.ts
|
|
387
|
-
├── record-web3-product.interface.ts
|
|
388
|
-
└── web3-context.interface.ts
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
- **`chains.ts`**: Defines the `Chain` enum (e.g., ETH, POLYGON) and related types.
|
|
392
|
-
- **`chain.config.ts`**: Provides `getDeployerAddress`, `getProxyAddress`, and other address-fetching utilities.
|
|
393
|
-
- **`web3-config.ts`**: Exports `Web3Actions` enum and `Web3ChainConfig` interface used by the `DropWeb3` factory.
|
|
394
|
-
- **`chain-constants.ts`**: Common constants like `ZERO_ADDRESS` and retry settings.
|
|
395
|
-
- **`chain-structs.ts`**: Strong-type wrappers for on-chain data (e.g., `EthAddress`, `Uint256`).
|
|
396
|
-
- **`chain-errors.ts`**: Domain-specific error classes covering wallet, RPC, and contract errors.
|
|
397
|
-
- **Interfaces**: Define method signatures and data shapes for all features (login, deployment, recording, payments, airdrops, modal interactions).
|
|
398
|
-
|
|
399
|
-
By understanding this DTO layer, developers can see how configuration and data shapes flow through the factory into each provider.
|
|
400
|
-
|