@zebec-network/exchange-card-sdk 1.4.1 → 1.5.0-beta.2
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 +0 -283
- package/dist/artifacts/abi/index.js +2 -8
- package/dist/artifacts/index.js +2 -18
- package/dist/artifacts/typechain-types/ERC20.js +1 -2
- package/dist/artifacts/typechain-types/common.js +1 -2
- package/dist/artifacts/typechain-types/factories/ERC20__factory.js +4 -8
- package/dist/artifacts/typechain-types/factories/index.js +1 -5
- package/dist/artifacts/typechain-types/index.js +2 -39
- package/dist/constants.js +11 -14
- package/dist/helpers/apiHelpers.js +12 -19
- package/dist/index.js +5 -21
- package/dist/services/algorandService.js +26 -33
- package/dist/services/bitcoinService.js +10 -50
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +7 -22
- package/dist/services/nearService.js +18 -26
- package/dist/services/octaService.js +7 -11
- package/dist/services/stellarService.js +20 -24
- package/dist/services/xdbService.js +14 -18
- package/dist/services/xrplService.js +14 -18
- package/dist/services/zanoService.d.ts +56 -0
- package/dist/services/zanoService.js +107 -0
- package/dist/types.js +1 -2
- package/dist/utils.js +13 -24
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -23,28 +23,6 @@ Example:
|
|
|
23
23
|
For EVM compatible networks:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { ethers } from 'ethers';
|
|
27
|
-
import { ZebecCardService, Recipient, CountryCode } from '@zebec-fintech/silver-card-sdk';
|
|
28
|
-
|
|
29
|
-
const signer: ethers.Signer = ... ; // Signer instance from Wallet Extension
|
|
30
|
-
|
|
31
|
-
const chainId = 11155111; // Sepolia testnet
|
|
32
|
-
const apiKey = process.env.API_KEY!;
|
|
33
|
-
const encryptionKey = process.env.ENCRYPTION_KEY!;
|
|
34
|
-
|
|
35
|
-
const service = new ZebecCardService(
|
|
36
|
-
signer,
|
|
37
|
-
chainId,
|
|
38
|
-
{
|
|
39
|
-
apiKey,
|
|
40
|
-
encryptionKey,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
sandbox: true, // Set to true for development or testing
|
|
44
|
-
},
|
|
45
|
-
);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
26
|
For Bittensor Network:
|
|
49
27
|
|
|
50
28
|
```typescript
|
|
@@ -76,264 +54,3 @@ Note: The `fetchQuote` method should be called regularly. Make sure to check it'
|
|
|
76
54
|
const amount = "150.55"; // Amount in USD
|
|
77
55
|
const quote = await service.fetchQuote(amount);
|
|
78
56
|
```
|
|
79
|
-
|
|
80
|
-
#### Response
|
|
81
|
-
|
|
82
|
-
The `fetchQuote` method returns a quote object with the following fields:
|
|
83
|
-
|
|
84
|
-
- **id**: Unique quote identifier.
|
|
85
|
-
- **token**: Name or symbol of the token used to purchase the card. (e.g., `"USDC"`, `"TAO"`)
|
|
86
|
-
- **targetCurrency**: Currency code for the amount. (e.g., `"USD"`)
|
|
87
|
-
- **amountRequested**: Amount of USD the card is being purchased for.
|
|
88
|
-
- **pricePerUnitCurrency**: Price of the token per unit USD.
|
|
89
|
-
- **totalPrice**: Total token amount needed for purchase.
|
|
90
|
-
- **platformFee**: Any additional fees charged by the platform.
|
|
91
|
-
- **expiresIn**: Time in milliseconds before the quote expires.
|
|
92
|
-
- **timestamp**: Timestamp when the quote was generated.
|
|
93
|
-
- **status**: Quote status.
|
|
94
|
-
|
|
95
|
-
### Purchase Card
|
|
96
|
-
|
|
97
|
-
The `purchaseCard` method initiates a virtual card purchase. It performs four main operations:
|
|
98
|
-
|
|
99
|
-
1. Approves token spending to the ZebecCard smart contract. (ERC20 tokens only)
|
|
100
|
-
2. Deposits tokens into the user's Zebec vault.
|
|
101
|
-
3. Initiates the card purchase on-chain. (ERC20 tokens only)
|
|
102
|
-
4. Posts transaction data, along with metadata, to the Zebec backend.
|
|
103
|
-
|
|
104
|
-
The method returns a tuple with responses from each stage of the process.
|
|
105
|
-
|
|
106
|
-
#### Code Example
|
|
107
|
-
|
|
108
|
-
For EVM compatible networks:
|
|
109
|
-
|
|
110
|
-
```typescript
|
|
111
|
-
const participantId = "JohnChamling";
|
|
112
|
-
const firstName = "John";
|
|
113
|
-
const lastName = "Chamling";
|
|
114
|
-
const emailAddress = "user@example.com";
|
|
115
|
-
const mobilePhone = "+91 012345678";
|
|
116
|
-
const language = "en-US";
|
|
117
|
-
const city = "Bharatpur";
|
|
118
|
-
const state = "Bagmati";
|
|
119
|
-
const postalCode = "44200";
|
|
120
|
-
const countryCode: CountryCode = "NPL";
|
|
121
|
-
const address1 = "Shittal street, Bharatpur - 10, Chitwan";
|
|
122
|
-
|
|
123
|
-
const recipient = Recipient.create(
|
|
124
|
-
participantId,
|
|
125
|
-
firstName,
|
|
126
|
-
lastName,
|
|
127
|
-
emailAddress,
|
|
128
|
-
mobilePhone,
|
|
129
|
-
language,
|
|
130
|
-
city,
|
|
131
|
-
state,
|
|
132
|
-
postalCode,
|
|
133
|
-
countryCode,
|
|
134
|
-
address1,
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const amount = "150.55";
|
|
138
|
-
const quote = await service.fetchQuote(amount);
|
|
139
|
-
const [depositResponse, buyCardResponse, apiResponse] = await service.purchaseCard({
|
|
140
|
-
amount,
|
|
141
|
-
recipient,
|
|
142
|
-
quote,
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
console.log("Deposit Transaction Hash:", depositResponse.hash);
|
|
146
|
-
console.log("Purchase Transaction Hash:", buyCardResponse.hash);
|
|
147
|
-
console.log("Zebec Server Response:", apiResponse.data);
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
For Bittensor Network:
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
const participantId = "JohnChamling";
|
|
154
|
-
const firstName = "John";
|
|
155
|
-
const lastName = "Chamling";
|
|
156
|
-
const emailAddress = "user@example.com";
|
|
157
|
-
const mobilePhone = "+91 012345678";
|
|
158
|
-
const language = "en-US";
|
|
159
|
-
const city = "Bharatpur";
|
|
160
|
-
const state = "Bagmati";
|
|
161
|
-
const postalCode = "44200";
|
|
162
|
-
const countryCode: CountryCode = "NPL";
|
|
163
|
-
const address1 = "Shittal street, Bharatpur - 10, Chitwan";
|
|
164
|
-
|
|
165
|
-
const recipient = Recipient.create(
|
|
166
|
-
participantId,
|
|
167
|
-
firstName,
|
|
168
|
-
lastName,
|
|
169
|
-
emailAddress,
|
|
170
|
-
mobilePhone,
|
|
171
|
-
language,
|
|
172
|
-
city,
|
|
173
|
-
state,
|
|
174
|
-
postalCode,
|
|
175
|
-
countryCode,
|
|
176
|
-
address1,
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
const amount = "150.55"; // Amount in USD
|
|
180
|
-
const quote = await service.fetchQuote(amount);
|
|
181
|
-
const [depositResponse, apiResponse] = await service.purchaseCard({
|
|
182
|
-
walletAddress: signer.address || "<wallet_address>",
|
|
183
|
-
amount,
|
|
184
|
-
recipient,
|
|
185
|
-
quote,
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
console.log(
|
|
189
|
-
`Deposit response: \n BlockHash: ${depositResponse.blockHash} \n TransactionHash: ${depositResponse.txHash}`,
|
|
190
|
-
);
|
|
191
|
-
console.log("Zebec Server Response:", apiResponse.data);
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## Configuration Parameters
|
|
197
|
-
|
|
198
|
-
### ZebecCardService
|
|
199
|
-
|
|
200
|
-
To create an instance of `ZebecCardService`, you need:
|
|
201
|
-
|
|
202
|
-
- **signer**: An instance of `ethers.Signer`.
|
|
203
|
-
- **chainId**: The ID of the blockchain (see list of supported chains below).
|
|
204
|
-
- **apiConfig**: Object containing `apiKey` and `encryptionKey`.
|
|
205
|
-
- **sdkConfig (optional)**: SDK-specific settings, such as:
|
|
206
|
-
- `sandbox`: Boolean, set to `true` for testnets.
|
|
207
|
-
|
|
208
|
-
### ZebecCardTAOService
|
|
209
|
-
|
|
210
|
-
To create an instance of `ZebecCardTAOService`, you need:
|
|
211
|
-
|
|
212
|
-
- **signer**: An instance of `Keyring` or `Signer`.
|
|
213
|
-
- **apiConfig**: Object containing `apiKey` and `encryptionKey`.
|
|
214
|
-
- **sdkConfig (optional)**: SDK-specific settings, such as:
|
|
215
|
-
- `sandbox`: Boolean, set to `true` for testnets.
|
|
216
|
-
|
|
217
|
-
### EVM Supported Chains
|
|
218
|
-
|
|
219
|
-
| Chain | Chain ID |
|
|
220
|
-
| ------------------- | ------------------------------- |
|
|
221
|
-
| Ethereum | Mainnet (1), Sepolia (11155111) |
|
|
222
|
-
| Binance Smart Chain | Mainnet (56), Testnet (97) |
|
|
223
|
-
| Base | Mainnet (8453) |
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
## Recipient Fields
|
|
228
|
-
|
|
229
|
-
To create a valid `Recipient` instance, provide the following details:
|
|
230
|
-
|
|
231
|
-
- **participantId** (alphanumeric string): Unique identifier for the buyer end user. 1-20 chars.
|
|
232
|
-
- **firstName**, **lastName** (string): Participant's full name.
|
|
233
|
-
- **emailAddress** (string): Contact email. 1-80 chars
|
|
234
|
-
- **mobilePhone** (string): Mobile number with country code.
|
|
235
|
-
- **language** (string): Language code (e.g., `"en-US"`).
|
|
236
|
-
- **city**, **state**, **postalCode** (string): Location details.
|
|
237
|
-
- **countryCode** (CountryCode enum): ISO 3166-1 alpha-3 country code.
|
|
238
|
-
- **address1** (string): Street address. (max 50 chars)
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Responses
|
|
243
|
-
|
|
244
|
-
The `purchaseCard` method returns three responses:
|
|
245
|
-
|
|
246
|
-
1. **depositResponse**: Transaction response for token deposit.
|
|
247
|
-
2. **buyCardResponse**: Transaction response for card purchase. (EVM only)
|
|
248
|
-
3. **apiResponse**: API response from Zebec's backend with additional transaction metadata.
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## Environment Variables
|
|
253
|
-
|
|
254
|
-
- **API_KEY**: Your Zebec API Key.
|
|
255
|
-
- **ENCRYPTION_KEY**: Your Zebec encryption key for secure data handling.
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
## Supported Countries
|
|
260
|
-
|
|
261
|
-
| Country | Code |
|
|
262
|
-
| -------------------------------- | ---- |
|
|
263
|
-
| Algeria | DZA |
|
|
264
|
-
| Angola | AGO |
|
|
265
|
-
| Argentina | ARG |
|
|
266
|
-
| Australia | AUS |
|
|
267
|
-
| Austria | AUT |
|
|
268
|
-
| Belgium | BEL |
|
|
269
|
-
| Bolivia (Plurinational State of) | BOL |
|
|
270
|
-
| Brazil | BRA |
|
|
271
|
-
| Cameroon | CMR |
|
|
272
|
-
| Canada | CAN |
|
|
273
|
-
| Chile | CHL |
|
|
274
|
-
| Costa Rica | CRI |
|
|
275
|
-
| Cyprus | CYP |
|
|
276
|
-
| Czechia | CZE |
|
|
277
|
-
| Denmark | DNK |
|
|
278
|
-
| Ecuador | ECU |
|
|
279
|
-
| Egypt | EGY |
|
|
280
|
-
| El Salvador | SLV |
|
|
281
|
-
| Estonia | EST |
|
|
282
|
-
| Finland | FIN |
|
|
283
|
-
| France | FRA |
|
|
284
|
-
| Georgia | GEO |
|
|
285
|
-
| Germany | DEU |
|
|
286
|
-
| Ghana | GHA |
|
|
287
|
-
| Greece | GRC |
|
|
288
|
-
| Guatemala | GTM |
|
|
289
|
-
| Honduras | HND |
|
|
290
|
-
| Hungary | HUN |
|
|
291
|
-
| Iceland | ISL |
|
|
292
|
-
| Ireland | IRL |
|
|
293
|
-
| Italy | ITA |
|
|
294
|
-
| Jamaica | JAM |
|
|
295
|
-
| Japan | JPN |
|
|
296
|
-
| Jordan | JOR |
|
|
297
|
-
| Kenya | KEN |
|
|
298
|
-
| Korea, Republic of Korea | KOR |
|
|
299
|
-
| Kuwait | KWT |
|
|
300
|
-
| Lithuania | LTU |
|
|
301
|
-
| Luxembourg | LUX |
|
|
302
|
-
| Malawi | MWI |
|
|
303
|
-
| Malaysia | MYS |
|
|
304
|
-
| Malta | MLT |
|
|
305
|
-
| Mexico | MEX |
|
|
306
|
-
| Morocco | MAR |
|
|
307
|
-
| Mozambique | MOZ |
|
|
308
|
-
| Nepal | NPL |
|
|
309
|
-
| Netherlands | NLD |
|
|
310
|
-
| New Zealand | NZL |
|
|
311
|
-
| Nigeria | NGA |
|
|
312
|
-
| Norway | NOR |
|
|
313
|
-
| Oman | OMN |
|
|
314
|
-
| Pakistan | PAK |
|
|
315
|
-
| Papua New Guinea | PNG |
|
|
316
|
-
| Paraguay | PRY |
|
|
317
|
-
| Peru | PER |
|
|
318
|
-
| Philippines | PHL |
|
|
319
|
-
| Poland | POL |
|
|
320
|
-
| Portugal | PRT |
|
|
321
|
-
| Puerto Rico | PRI |
|
|
322
|
-
| Qatar | QAT |
|
|
323
|
-
| Romania | ROU |
|
|
324
|
-
| Saudi Arabia | SAU |
|
|
325
|
-
| Singapore | SGP |
|
|
326
|
-
| Slovakia | SVK |
|
|
327
|
-
| Slovenia | SVN |
|
|
328
|
-
| Spain | ESP |
|
|
329
|
-
| Sweden | SWE |
|
|
330
|
-
| Taiwan | TWN |
|
|
331
|
-
| Thailand | THA |
|
|
332
|
-
| Trinidad and Tobago | TTO |
|
|
333
|
-
| Tunisia | TUN |
|
|
334
|
-
| Turkey | TUR |
|
|
335
|
-
| United Kingdom | GBR |
|
|
336
|
-
| United States | USA |
|
|
337
|
-
| Uruguay | URY |
|
|
338
|
-
| Vanuatu | VUT |
|
|
339
|
-
| Zambia | ZMB |
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ERC20_ABI = void 0;
|
|
7
|
-
const ERC20_json_1 = __importDefault(require("./ERC20.json"));
|
|
8
|
-
exports.ERC20_ABI = ERC20_json_1.default.abi;
|
|
1
|
+
import ERC20 from "./ERC20.json";
|
|
2
|
+
export const ERC20_ABI = ERC20.abi;
|
package/dist/artifacts/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./abi"), exports);
|
|
18
|
-
__exportStar(require("./typechain-types"), exports);
|
|
1
|
+
export * from "./abi";
|
|
2
|
+
export * from "./typechain-types";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERC20__factory = void 0;
|
|
4
1
|
/* Autogenerated file. Do not edit manually. */
|
|
5
2
|
/* tslint:disable */
|
|
6
3
|
/* eslint-disable */
|
|
7
|
-
|
|
4
|
+
import { Contract, ContractFactory, Interface } from "ethers";
|
|
8
5
|
const _abi = [
|
|
9
6
|
{
|
|
10
7
|
inputs: [],
|
|
@@ -348,7 +345,7 @@ const _abi = [
|
|
|
348
345
|
];
|
|
349
346
|
const _bytecode = "0x608034620003fb5760406001600160401b0382820181811184821017620003e5578252600f835260206e21b0b932102a32b9ba102a37b5b2b760891b8185015282519383850185811084821117620003e55784526004928386526321aa25a760e11b83870152815195818711620003d057600390815497600194858a811c9a168015620003c5575b878b1014620003b0578190601f9a8b81116200035a575b5087908b8311600114620002f357600092620002e7575b505060001982851b1c191690851b1782555b8051928311620002d25785548481811c91168015620002c7575b86821014620002b25788811162000267575b5084978311600114620001fe5796829394959697600093620001f2575b505082841b92600019911b1c19161783555b600580546001600160a81b03191633600890811b610100600160a81b0316919091179290921790819055901c6001600160a01b0316918215620001db576002546a0422ca8b0a00a42500000091828201809211620001c6575060025560008381528083528481208054830190558451918252917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a3516107669081620004018239f35b601190634e487b7160e01b6000525260246000fd5b602490600085519163ec442f0560e01b8352820152fd5b01519150388062000110565b90601f1983169786600052856000209260005b8a811062000251575084869798999a1062000236575b50505050811b01835562000122565b01519060f884600019921b161c191690553880808062000227565b8183015185559386019391870191870162000211565b86600052856000208980860160051c820192888710620002a8575b0160051c019085905b8281106200029b575050620000f3565b600081550185906200028b565b9250819262000282565b602287634e487b7160e01b6000525260246000fd5b90607f1690620000e1565b604186634e487b7160e01b6000525260246000fd5b015190503880620000b5565b90879350601f1983169186600052896000209260005b8b8282106200034357505084116200032a575b505050811b018255620000c7565b015160001983871b60f8161c191690553880806200031c565b8385015186558b9790950194938401930162000309565b90915084600052876000208b80850160051c8201928a8610620003a6575b918991869594930160051c01915b828110620003965750506200009e565b6000815585945089910162000386565b9250819262000378565b602288634e487b7160e01b6000525260246000fd5b99607f169962000087565b604185634e487b7160e01b6000525260246000fd5b634e487b7160e01b600052604160045260246000fd5b600080fdfe608060408181526004918236101561001657600080fd5b600092833560e01c91826306fdde03146104b557508163075461721461048a578163095ea7b3146103de57816318160ddd146103bf5781631f2698ab1461039b57816323b872dd1461028c578163313ce5671461027057816370a082311461023a57816395d89b411461011957508063a9059cbb146100e95763dd62ed3e1461009e57600080fd5b346100e557806003193601126100e557806020926100ba6105d8565b6100c26105f3565b6001600160a01b0391821683526001865283832091168252845220549051908152f35b5080fd5b50346100e557806003193601126100e5576020906101126101086105d8565b6024359033610609565b5160018152f35b8383346100e557816003193601126100e55780519082845460018160011c9060018316928315610230575b602093848410811461021d5783885290811561020157506001146101ac575b505050829003601f01601f191682019267ffffffffffffffff841183851017610199575082918261019592528261058f565b0390f35b80604186634e487b7160e01b6024945252fd5b8787529192508591837f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8385106101ed5750505050830101858080610163565b8054888601830152930192849082016101d7565b60ff1916878501525050151560051b8401019050858080610163565b60248960228c634e487b7160e01b835252fd5b91607f1691610144565b5050346100e55760203660031901126100e557806020926001600160a01b036102616105d8565b16815280845220549051908152f35b5050346100e557816003193601126100e5576020905160128152f35b90508234610398576060366003190112610398576102a86105d8565b6102b06105f3565b91604435936001600160a01b0383168083526001602052868320338452602052868320549160001983036102ed575b602088610112898989610609565b86831061035357811561033d57331561032757508252600160209081528683203384528152918690209085900390558290610112876102df565b60249084895191634a1406b160e11b8352820152fd5b6024908489519163e602df0560e01b8352820152fd5b87517ffb8f41b2000000000000000000000000000000000000000000000000000000008152339181019182526020820193909352604081018790528291506060010390fd5b80fd5b5050346100e557816003193601126100e55760209060ff6005541690519015158152f35b5050346100e557816003193601126100e5576020906002549051908152f35b9050346104865781600319360112610486576103f86105d8565b602435903315610470576001600160a01b031691821561045a57508083602095338152600187528181208582528752205582519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925843392a35160018152f35b60249085855191634a1406b160e11b8352820152fd5b6024838686519163e602df0560e01b8352820152fd5b8280fd5b5050346100e557816003193601126100e5576020906001600160a01b0360055460081c169051908152f35b849084346104865782600319360112610486578260035460018160011c9060018316928315610585575b602093848410811461021d57838852908115610201575060011461052f57505050829003601f01601f191682019267ffffffffffffffff841183851017610199575082918261019592528261058f565b600387529192508591837fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8385106105715750505050830101858080610163565b80548886018301529301928490820161055b565b91607f16916104df565b6020808252825181830181905290939260005b8281106105c457505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016105a2565b600435906001600160a01b03821682036105ee57565b600080fd5b602435906001600160a01b03821682036105ee57565b916001600160a01b038084169283156106ff57169283156106ce5760009083825281602052604082205490838210610683575091604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220818154019055604051908152a3565b6040517fe450d38c0000000000000000000000000000000000000000000000000000000081526001600160a01b03919091166004820152602481019190915260448101839052606490fd5b60246040517fec442f0500000000000000000000000000000000000000000000000000000000815260006004820152fd5b60246040517f96c6fd1e00000000000000000000000000000000000000000000000000000000815260006004820152fdfea2646970667358221220a895ef5f3cf026b48a9ffb4320764182cae42330f3d36a62637bec75ffa74e3c64736f6c63430008180033";
|
|
350
347
|
const isSuperArgs = (xs) => xs.length > 1;
|
|
351
|
-
class ERC20__factory extends
|
|
348
|
+
export class ERC20__factory extends ContractFactory {
|
|
352
349
|
constructor(...args) {
|
|
353
350
|
if (isSuperArgs(args)) {
|
|
354
351
|
super(...args);
|
|
@@ -369,10 +366,9 @@ class ERC20__factory extends ethers_1.ContractFactory {
|
|
|
369
366
|
static bytecode = _bytecode;
|
|
370
367
|
static abi = _abi;
|
|
371
368
|
static createInterface() {
|
|
372
|
-
return new
|
|
369
|
+
return new Interface(_abi);
|
|
373
370
|
}
|
|
374
371
|
static connect(address, runner) {
|
|
375
|
-
return new
|
|
372
|
+
return new Contract(address, _abi, runner);
|
|
376
373
|
}
|
|
377
374
|
}
|
|
378
|
-
exports.ERC20__factory = ERC20__factory;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERC20__factory = void 0;
|
|
4
1
|
/* Autogenerated file. Do not edit manually. */
|
|
5
2
|
/* tslint:disable */
|
|
6
3
|
/* eslint-disable */
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "ERC20__factory", { enumerable: true, get: function () { return ERC20__factory_1.ERC20__factory; } });
|
|
4
|
+
export { ERC20__factory } from "./ERC20__factory";
|
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ERC20__factory = exports.factories = void 0;
|
|
37
|
-
exports.factories = __importStar(require("./factories"));
|
|
38
|
-
var ERC20__factory_1 = require("./factories/ERC20__factory");
|
|
39
|
-
Object.defineProperty(exports, "ERC20__factory", { enumerable: true, get: function () { return ERC20__factory_1.ERC20__factory; } });
|
|
1
|
+
export * as factories from "./factories";
|
|
2
|
+
export { ERC20__factory } from "./factories/ERC20__factory";
|
package/dist/constants.js
CHANGED
|
@@ -1,41 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PLATFORM_FEE = exports.COUNTRIES_WITH_CCA3 = exports.DEFAULT_EVM_GAS_LIMIT = exports.BITCOIN_ENDPOINTS = exports.STELLAR_USDC_ISSUER = exports.XDB_NETWORK = exports.XDB_RPC_URL = exports.STELLAR_RPC_URL = exports.XRPL_RPC_URL = exports.NEAR_RPC_URL = exports.CARD_API_URL = void 0;
|
|
4
|
-
exports.CARD_API_URL = {
|
|
1
|
+
export const CARD_API_URL = {
|
|
5
2
|
Production: "https://cex.card.zebec.io",
|
|
6
3
|
Sandbox: "https://cex.card.zebec.io",
|
|
7
4
|
};
|
|
8
|
-
|
|
5
|
+
export const NEAR_RPC_URL = {
|
|
9
6
|
Production: process.env.NEAR_RPC_URL ? process.env.NEAR_RPC_URL : "https://rpc.mainnet.near.org",
|
|
10
7
|
Sandbox: "https://rpc.testnet.near.org",
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
export const XRPL_RPC_URL = {
|
|
13
10
|
Production: "wss://xrplcluster.com",
|
|
14
11
|
Sandbox: "wss://s.altnet.rippletest.net:51233",
|
|
15
12
|
};
|
|
16
|
-
|
|
13
|
+
export const STELLAR_RPC_URL = {
|
|
17
14
|
Production: "https://horizon.stellar.org",
|
|
18
15
|
Sandbox: "https://horizon-testnet.stellar.org",
|
|
19
16
|
};
|
|
20
|
-
|
|
17
|
+
export const XDB_RPC_URL = {
|
|
21
18
|
Production: "https://horizon.livenet.xdbchain.com/",
|
|
22
19
|
Sandbox: "https://horizon.futurenet.xdbchain.com/",
|
|
23
20
|
};
|
|
24
|
-
|
|
21
|
+
export const XDB_NETWORK = {
|
|
25
22
|
PUBLIC: "LiveNet Global XDBChain Network ; November 2023",
|
|
26
23
|
TESTNET: "Futurenet XDBChain Network ; October 2023",
|
|
27
24
|
};
|
|
28
25
|
// Add USDC asset constants
|
|
29
|
-
|
|
26
|
+
export const STELLAR_USDC_ISSUER = {
|
|
30
27
|
Sandbox: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
|
|
31
28
|
Production: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
|
|
32
29
|
};
|
|
33
|
-
|
|
30
|
+
export const BITCOIN_ENDPOINTS = {
|
|
34
31
|
Sandbox: "https://mempool.space/testnet/api",
|
|
35
32
|
Production: "https://mempool.space/api",
|
|
36
33
|
};
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
export const DEFAULT_EVM_GAS_LIMIT = 3000000;
|
|
35
|
+
export const COUNTRIES_WITH_CCA3 = [
|
|
39
36
|
{
|
|
40
37
|
name: {
|
|
41
38
|
common: "South Georgia",
|
|
@@ -2486,4 +2483,4 @@ exports.COUNTRIES_WITH_CCA3 = [
|
|
|
2486
2483
|
cca3: "AIA",
|
|
2487
2484
|
},
|
|
2488
2485
|
];
|
|
2489
|
-
|
|
2486
|
+
export const PLATFORM_FEE = 5 * 100;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ZebecCardAPIService = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
9
|
-
const constants_1 = require("../constants");
|
|
10
|
-
class ZebecCardAPIService {
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import crypto from "crypto";
|
|
3
|
+
import { CARD_API_URL } from "../constants";
|
|
4
|
+
export class ZebecCardAPIService {
|
|
11
5
|
apiConfig;
|
|
12
6
|
sdkVersion = "1.0.0";
|
|
13
7
|
api;
|
|
14
8
|
constructor(apiConfig, sandbox) {
|
|
15
9
|
this.apiConfig = {
|
|
16
10
|
...apiConfig,
|
|
17
|
-
apiUrl: sandbox ?
|
|
11
|
+
apiUrl: sandbox ? CARD_API_URL.Sandbox : CARD_API_URL.Production,
|
|
18
12
|
};
|
|
19
|
-
this.api =
|
|
13
|
+
this.api = axios.create({ baseURL: this.apiConfig.apiUrl });
|
|
20
14
|
}
|
|
21
15
|
// Generate request signature
|
|
22
16
|
generateSignature(method, path, timestamp, body) {
|
|
@@ -27,7 +21,7 @@ class ZebecCardAPIService {
|
|
|
27
21
|
this.apiConfig.apiKey,
|
|
28
22
|
body ? JSON.stringify(body) : "",
|
|
29
23
|
].join("");
|
|
30
|
-
return
|
|
24
|
+
return crypto
|
|
31
25
|
.createHmac("sha256", this.apiConfig.encryptionKey)
|
|
32
26
|
.update(stringToSign)
|
|
33
27
|
.digest("hex");
|
|
@@ -35,7 +29,7 @@ class ZebecCardAPIService {
|
|
|
35
29
|
// Generate request headers
|
|
36
30
|
generateRequestHeaders(method, path, body) {
|
|
37
31
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
38
|
-
const nonce =
|
|
32
|
+
const nonce = crypto.randomBytes(16).toString("hex");
|
|
39
33
|
return {
|
|
40
34
|
"X-API-Key": this.apiConfig.apiKey,
|
|
41
35
|
"X-Timestamp": timestamp.toString(),
|
|
@@ -47,9 +41,9 @@ class ZebecCardAPIService {
|
|
|
47
41
|
}
|
|
48
42
|
// Encrypt sensitive data fields
|
|
49
43
|
encryptSensitiveData(data) {
|
|
50
|
-
const iv =
|
|
51
|
-
const key =
|
|
52
|
-
const cipher =
|
|
44
|
+
const iv = crypto.randomBytes(16);
|
|
45
|
+
const key = crypto.pbkdf2Sync(this.apiConfig.encryptionKey, iv, 1000, 32, "sha256");
|
|
46
|
+
const cipher = crypto.createCipheriv("aes-256-gcm", key, iv);
|
|
53
47
|
let encrypted = cipher.update(JSON.stringify(data), "utf8", "base64");
|
|
54
48
|
encrypted += cipher.final("base64");
|
|
55
49
|
const authTag = cipher.getAuthTag();
|
|
@@ -75,7 +69,7 @@ class ZebecCardAPIService {
|
|
|
75
69
|
const url = this.apiConfig.apiUrl + path;
|
|
76
70
|
const payload = { data: encryptedData };
|
|
77
71
|
const headers = this.generateRequestHeaders(method, path, payload);
|
|
78
|
-
const response = await
|
|
72
|
+
const response = await axios.post(url, payload, { headers });
|
|
79
73
|
return response;
|
|
80
74
|
}
|
|
81
75
|
// Fetch quote
|
|
@@ -89,4 +83,3 @@ class ZebecCardAPIService {
|
|
|
89
83
|
return data.data;
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
|
-
exports.ZebecCardAPIService = ZebecCardAPIService;
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./artifacts"), exports);
|
|
18
|
-
__exportStar(require("./constants"), exports);
|
|
19
|
-
__exportStar(require("./services"), exports);
|
|
20
|
-
__exportStar(require("./types"), exports);
|
|
21
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
export * from "./artifacts";
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export * from "./services";
|
|
4
|
+
export * from "./types";
|
|
5
|
+
export * from "./utils";
|