llama-pay-sdk 3.9.3 → 4.0.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.
Files changed (46) hide show
  1. package/lib/MerapiClient.d.ts +18 -1
  2. package/lib/MerapiClient.d.ts.map +1 -1
  3. package/lib/MerapiClient.js +42 -2
  4. package/lib/MerapiClient.js.map +1 -1
  5. package/lib/index.d.ts +1 -0
  6. package/lib/index.d.ts.map +1 -1
  7. package/lib/index.js.map +1 -1
  8. package/lib/models/LinkedCard.d.ts +5 -0
  9. package/lib/models/LinkedCard.d.ts.map +1 -0
  10. package/lib/models/LinkedCard.js +3 -0
  11. package/lib/models/LinkedCard.js.map +1 -0
  12. package/lib/models/WalletAccount.d.ts +8 -0
  13. package/lib/models/WalletAccount.d.ts.map +1 -0
  14. package/lib/models/WalletAccount.js +3 -0
  15. package/lib/models/WalletAccount.js.map +1 -0
  16. package/lib/models/cashout/CashoutLimits.d.ts +1 -1
  17. package/lib/models/cashout/CashoutLimits.d.ts.map +1 -1
  18. package/package.json +4 -1
  19. package/src/CashoutClient.ts +0 -139
  20. package/src/HttpClient.ts +0 -116
  21. package/src/MerapiClient.ts +0 -453
  22. package/src/crypto.ts +0 -144
  23. package/src/device-info.ts +0 -38
  24. package/src/dora/DoraApiClient.ts +0 -58
  25. package/src/dora/index.ts +0 -6
  26. package/src/dora/types/Transaction.ts +0 -31
  27. package/src/erc20Abi.ts +0 -222
  28. package/src/index.ts +0 -31
  29. package/src/models/Balance.ts +0 -16
  30. package/src/models/FeatureFlags.ts +0 -4
  31. package/src/models/IBinInfo.ts +0 -24
  32. package/src/models/IMultisigTransaction.ts +0 -48
  33. package/src/models/IMultisigWallet.ts +0 -40
  34. package/src/models/ITokenInfo.ts +0 -9
  35. package/src/models/IUser.ts +0 -9
  36. package/src/models/ResponseWrapper.ts +0 -8
  37. package/src/models/SimpleMultisigTransactionData.ts +0 -28
  38. package/src/models/Transaction.ts +0 -12
  39. package/src/models/Wallet.ts +0 -17
  40. package/src/models/cashout/Atm.ts +0 -23
  41. package/src/models/cashout/CashoutLimits.ts +0 -10
  42. package/src/models/cashout/CashoutRequest.ts +0 -16
  43. package/src/models/cashout/CashoutResponse.ts +0 -14
  44. package/src/models/cashout/CashoutStatus.ts +0 -14
  45. package/src/models/cashout/CreateCashoutResponse.ts +0 -7
  46. package/tsconfig.json +0 -18
@@ -1,453 +0,0 @@
1
- import axios, { AxiosInstance, AxiosResponse } from 'axios'
2
- import { getBundleId, getDeviceId, getUserAgent } from './device-info'
3
- import { BalanceResponse } from './models/Balance'
4
- import { Atm } from './models/cashout/Atm'
5
- import { CashoutRequest } from './models/cashout/CashoutRequest'
6
- import { CreateCashoutResponse } from './models/cashout/CreateCashoutResponse'
7
- import { FeatureFlags } from './models/FeatureFlags'
8
- import {
9
- ICreditCardMultisigWallet,
10
- IGeneralMultisigWallet
11
- } from './models/IMultisigWallet'
12
- import { ITokenInfo } from './models/ITokenInfo'
13
- import { IMultisigTransaction } from './models/IMultisigTransaction'
14
- import { IUser } from './models/IUser'
15
- import ResponseWrapper from './models/ResponseWrapper'
16
- import { CashoutLimits } from './models/cashout/CashoutLimits'
17
- import CashoutResponse from './models/cashout/CashoutResponse'
18
- import { Transaction } from './models/Transaction'
19
-
20
- type AuthTokenProvider = () => Promise<string | null>
21
-
22
- type Response<T> = {
23
- result: 'ok' | 'error'
24
- error: {
25
- code: string
26
- server_message: string
27
- } | null
28
- data: T
29
- }
30
-
31
- export class MerapiClient {
32
- http: AxiosInstance
33
-
34
- private deviceId?: string
35
- private userAgent?: string
36
- private bundleId?: string
37
-
38
- afterRequestCallback?: (
39
- responseBody: any,
40
- response: AxiosResponse
41
- ) => void | Promise<void>
42
-
43
- authTokenProvider?: AuthTokenProvider
44
-
45
- constructor(params: { baseUrl: string; clientId: string }) {
46
- this.http = axios.create({
47
- baseURL: params.baseUrl,
48
- timeout: 30 * 1000,
49
- headers: {
50
- 'Content-Type': 'application/json',
51
- Accept: 'application/json',
52
- 'X-Client-Id': params.clientId
53
- },
54
- validateStatus: () => true
55
- })
56
-
57
- this.http.interceptors.request.use(
58
- async (config) => {
59
- config.headers = config.headers ?? {}
60
-
61
- if (!this.deviceId) this.deviceId = await getDeviceId()
62
- if (!this.userAgent) this.userAgent = await getUserAgent()
63
- if (!this.bundleId) this.bundleId = await getBundleId()
64
-
65
- const token = await this.authTokenProvider?.()
66
-
67
- if (token) config.headers.Authorization = token
68
- if (this.deviceId) config.headers['X-Device-ID'] = this.deviceId
69
- if (this.userAgent)
70
- config.headers['User-Agent'] = this.userAgent
71
- if (this.bundleId) config.headers['X-Bundle-Id'] = this.bundleId
72
-
73
- return config
74
- },
75
- (error) => Promise.reject(error)
76
- )
77
-
78
- this.http.interceptors.response.use(
79
- (response) => {
80
- const body = response.data
81
-
82
- this.afterRequestCallback?.call(null, body, response)
83
-
84
- const errorMessage =
85
- body?.error?.server_message || body?.error?.code
86
- if (errorMessage) {
87
- return Promise.reject(new Error(errorMessage))
88
- }
89
- return response
90
- },
91
- (error) => {
92
- return Promise.reject(error)
93
- }
94
- )
95
- }
96
-
97
- setAuthTokenProvider(provider: AuthTokenProvider) {
98
- this.authTokenProvider = provider
99
- }
100
-
101
- generateLoginCode = async (params: {
102
- contact: string
103
- password?: string
104
- }): Promise<void> => {
105
- await this.http.post('/wallet/login/code', params)
106
- }
107
-
108
- confirmLoginCode = async (params: {
109
- contact: string
110
- code: string
111
- }): Promise<{
112
- sessionKey: string
113
- }> => {
114
- return this.http
115
- .post<
116
- Response<{ sessionKey: string }>
117
- >('/wallet/login/confirm', params)
118
- .then((res) => res.data.data)
119
- }
120
-
121
- getCurrentUser = async (): Promise<IUser> => {
122
- return this.http.get<IUser>('/wallet/users/me').then((res) => res.data)
123
- }
124
-
125
- updateProfile = async (params: {
126
- firstName: string
127
- lastName: string
128
- }): Promise<IUser> => {
129
- return this.http
130
- .post<IUser>('/wallet/profile', {
131
- first_name: params.firstName,
132
- second_name: params.lastName
133
- })
134
- .then((res) => res.data)
135
- }
136
-
137
- getBalances = (
138
- address: string,
139
- tokens: {
140
- tokenAddress: string | null
141
- }[]
142
- ): Promise<BalanceResponse[]> => {
143
- return this.http
144
- .post(`/wallet/blockchain/${address}/get-balance`, {
145
- tokens
146
- })
147
- .then((res) => res.data)
148
- }
149
-
150
- setUserPublicAddress = async (params: { address: string }) => {
151
- await this.http.post('/wallet/users/set-address', params)
152
- }
153
-
154
- getDefaultTokens = (): Promise<ITokenInfo[]> => {
155
- return this.http
156
- .get<ITokenInfo[]>(`/wallet/blockchain/tokens`)
157
- .then((res) => res.data)
158
- }
159
-
160
- createMultisigWallet = (params: {
161
- name: string
162
- signers: string[]
163
- threshold: number
164
- }): Promise<IGeneralMultisigWallet> => {
165
- return this.http
166
- .post<IGeneralMultisigWallet>('/wallet/wallets', params)
167
- .then((res) => res.data)
168
- }
169
-
170
- acceptMultisigWallet = async (walletId: string) => {
171
- await this.http.post(`/wallet/wallets/${walletId}/accept`, { walletId })
172
- }
173
-
174
- getMultisigWallets = (): Promise<IGeneralMultisigWallet[]> => {
175
- return this.http
176
- .get<IGeneralMultisigWallet[]>('/wallet/wallets')
177
- .then((res) => res.data)
178
- }
179
-
180
- createMultisigTransaction = (params: {
181
- walletId: string
182
- assetType: 'native' | 'erc20'
183
- to: string
184
- amount: string
185
- tokenAddress: string | null
186
- remark: string | null
187
- }): Promise<IMultisigTransaction> => {
188
- return this.http
189
- .post<IMultisigTransaction>('/wallet/tx', params)
190
- .then((res) => res.data)
191
- }
192
-
193
- getMultisigWalletTransactions = (
194
- walletId: string
195
- ): Promise<IMultisigTransaction[]> => {
196
- return this.http
197
- .get<IMultisigTransaction[]>(`/wallet/wallets/${walletId}/tx`)
198
- .then((res) => res.data)
199
- }
200
-
201
- getMultisigWalletTransaction = async (
202
- txId: string
203
- ): Promise<IMultisigTransaction> => {
204
- return this.http
205
- .get<IMultisigTransaction>(`/wallet/tx/${txId}`)
206
- .then((res) => res.data)
207
- }
208
-
209
- addMultisigTxSignature = (
210
- txId: string,
211
- data: { txid: string; address: string; signature: string }
212
- ): Promise<IMultisigTransaction> => {
213
- return this.http
214
- .post<IMultisigTransaction>(`/wallet/tx/${txId}/signature`, data)
215
- .then((res) => res.data)
216
- }
217
-
218
- executeTransaction = (txId: string): Promise<IMultisigTransaction> => {
219
- return this.http
220
- .post<IMultisigTransaction>(`/wallet/tx/${txId}/execute`, {
221
- txid: txId
222
- })
223
- .then((res) => res.data)
224
- }
225
-
226
- getCCWallet = async (): Promise<ICreditCardMultisigWallet | null> => {
227
- const response =
228
- await this.http.get<ICreditCardMultisigWallet>('/wallet/ccwallet')
229
- const wallet = response.data
230
- if (wallet && Object.keys(wallet).length > 0) {
231
- return wallet as ICreditCardMultisigWallet
232
- }
233
- return null
234
- }
235
-
236
- getCCWalletTransactions = (
237
- walletId: string
238
- ): Promise<IMultisigTransaction[]> => {
239
- return this.http
240
- .get<IMultisigTransaction[]>(`/wallet/ccwallet/${walletId}/tx`)
241
- .then((res) => res.data)
242
- }
243
-
244
- createCCWallet = (params: {
245
- pan: string
246
- }): Promise<ICreditCardMultisigWallet> => {
247
- return this.http
248
- .post<ICreditCardMultisigWallet>('/wallet/ccwallet', params)
249
- .then((res) => res.data)
250
- }
251
-
252
- executePosTransaction = (params: {
253
- destination: string
254
- panHash: string
255
- amount: string
256
- remark?: string
257
- merchant: string
258
- confirmations?: number
259
- }): Promise<IMultisigTransaction> => {
260
- return this.http
261
- .post<IMultisigTransaction>('/wallet/tx/pos', params)
262
- .then((res) => res.data)
263
- }
264
-
265
- getTokenInfo = async (tokenAddress: string): Promise<ITokenInfo | null> => {
266
- return this.http
267
- .get<ITokenInfo | null>(
268
- `/wallet/blockchain/${tokenAddress}/token-info`
269
- )
270
- .then((res) => res.data)
271
- }
272
-
273
- getFeatureFlags = async (): Promise<FeatureFlags> => {
274
- // TODO: remove mock
275
- return {
276
- multisignatureWallet: true,
277
- paymentWallet: true
278
- }
279
- }
280
-
281
- markTopup = async (
282
- walletId: string,
283
- hash: string
284
- ): Promise<IMultisigTransaction> => {
285
- return this.http
286
- .post<IMultisigTransaction>(`/wallet/ccwallet/${walletId}/topup`, {
287
- walletId,
288
- hash
289
- })
290
- .then((res) => res.data)
291
- }
292
-
293
- // cashout
294
-
295
- getCashoutLimits = async (): Promise<CashoutLimits> => {
296
- return this.http
297
- .get<CashoutLimits>('/cashout/limits')
298
- .then((res) => res.data)
299
- }
300
-
301
- getAtmList = async () => {
302
- const response =
303
- await this.http.get<ResponseWrapper<{ items: Atm[] }>>(
304
- '/cashout/atm/list'
305
- )
306
- return response.data.data.items
307
- }
308
-
309
- sendVerificationWord = async (params: {
310
- firstName: string
311
- lastName: string
312
- phoneNumber: string
313
- }) => {
314
- const data = new URLSearchParams()
315
- data.append('first_name', params.firstName)
316
- data.append('last_name', params.lastName)
317
- data.append('phone_number', params.phoneNumber)
318
- data.append('word_code', '1')
319
- data.append('_t', new Date().getTime().toString())
320
-
321
- await this.http.post('/cashout/pcode/verify', data, {
322
- headers: {
323
- 'Content-Type': 'application/x-www-form-urlencoded'
324
- }
325
- })
326
- }
327
-
328
- createCashoutRequest = async (params: {
329
- atmId: string
330
- amount: string
331
- }): Promise<CreateCashoutResponse> => {
332
- const data = new URLSearchParams()
333
- data.append('atm_id', params.atmId)
334
- data.append('amount', params.amount)
335
- data.append('_t', new Date().getTime().toString())
336
-
337
- const response = await this.http.post<
338
- ResponseWrapper<{
339
- items: [
340
- {
341
- secure_code: string
342
- address: string
343
- usd_amount: number
344
- btc_amount: number
345
- btc_whole_unit_price: number
346
- }
347
- ]
348
- }>
349
- >('/cashout/pcode', data, {
350
- headers: {
351
- 'Content-Type': 'application/x-www-form-urlencoded'
352
- }
353
- })
354
- const result = response.data.data.items[0]
355
-
356
- return {
357
- secureCode: result.secure_code,
358
- address: result.address,
359
- usdAmount: result.usd_amount,
360
- btcAmount: result.btc_amount,
361
- btcWholeUnitPrice: result.btc_whole_unit_price
362
- }
363
- }
364
-
365
- getCashOutRequest = async (cashCode: string): Promise<CashoutRequest> => {
366
- const response = await this.http.get<
367
- ResponseWrapper<{
368
- items: CashoutResponse[]
369
- }>
370
- >(`/cashout/pcode/${cashCode}`)
371
- const result = response.data.data.items[0]
372
- return buildCashoutItem(result)
373
- }
374
-
375
- getCashOutRequests = async (): Promise<CashoutRequest[]> => {
376
- const response = await this.http.get<
377
- ResponseWrapper<{
378
- items: []
379
- }>
380
- >('/cashout/pcodes')
381
- const result = response.data.data.items
382
- return result.map(buildCashoutItem)
383
- }
384
-
385
- linkCardToAddress = async (params: {
386
- address: string
387
- cardhash: string
388
- }): Promise<void> => {
389
- await this.http.post<ResponseWrapper<{ items: [{}] }>>(
390
- '/cashout/card/link',
391
- params
392
- )
393
- }
394
-
395
- getAddressByCardHash = async (
396
- cardhash: string
397
- ): Promise<string | undefined> => {
398
- const response = await this.http.get<
399
- ResponseWrapper<{ items: [{ address: string } | undefined] }>
400
- >(`/cashout/card/link?cardhash=${cardhash}`)
401
- return response.data.data.items[0]?.address
402
- }
403
-
404
- getLinkedCardsCount = async (): Promise<number> => {
405
- const response = await this.http.post<
406
- ResponseWrapper<{ items: [{ linked_cards_count: number }] }>
407
- >('/cashout/card/link/count')
408
- return response.data.data.items[0].linked_cards_count
409
- }
410
-
411
- submitTransaction = async (params: {
412
- transaction: string
413
- }): Promise<{
414
- hash: string
415
- }> => {
416
- const response = await this.http.post<{ hash: string }>(
417
- '/wallet/transaction',
418
- params
419
- )
420
- return response.data
421
- }
422
-
423
- getRpcUrl = async (): Promise<string> => {
424
- const response = await this.http.post<{ nodeUrl: string }>(
425
- '/wallet/service/info'
426
- )
427
- return response.data.nodeUrl
428
- }
429
-
430
- getTransactions = async (): Promise<Transaction[]> => {
431
- const response = await this.http.get<Transaction[]>(
432
- '/wallet/transactions'
433
- )
434
- return response.data
435
- }
436
- }
437
-
438
- function buildCashoutItem(result: CashoutResponse): CashoutRequest {
439
- return {
440
- secureCode: result.secure_code,
441
- pcode: result.pcode,
442
- status: result.status as any,
443
- address: result.address,
444
- usdAmount: result.usd_amount,
445
- btcAmount: result.btc_amount,
446
- btcWholeUnitPrice: result.btc_whole_unit_price,
447
- expiration: result.expiration,
448
- atmId: result.atm_id,
449
- locDescription: result.loc_description,
450
- locLat: result.loc_lat,
451
- locLon: result.loc_lon
452
- }
453
- }
package/src/crypto.ts DELETED
@@ -1,144 +0,0 @@
1
- import { ethers, TransactionResponse } from 'ethers'
2
- import { SimpleMultisigTransactionData } from './models/SimpleMultisigTransactionData'
3
- import { ERC20_ABI } from './erc20Abi'
4
-
5
- export type TransactionRequest = ethers.TransactionRequest
6
-
7
- export function getPublicAddress(privateKey: string) {
8
- return new ethers.Wallet(privateKey).address
9
- }
10
-
11
- export async function sendNative(
12
- privateKey: string,
13
- tx: TransactionRequest,
14
- rpcUrl?: string
15
- ): Promise<TransactionResponse> {
16
- let txReq = { ...tx }
17
- const provider = rpcUrl ? new ethers.JsonRpcProvider(rpcUrl) : null
18
- const wallet = new ethers.Wallet(privateKey, provider)
19
- return wallet.sendTransaction(txReq)
20
- }
21
-
22
- export async function sendERC20(
23
- privateKey: string,
24
- tx: TransactionRequest & { tokenAddress: string },
25
- rpcUrl?: string
26
- ): Promise<TransactionResponse> {
27
- if (!tx.to) throw new Error('Missing to')
28
- if (tx.value == null) throw new Error('Missing value')
29
-
30
- const provider = rpcUrl ? new ethers.JsonRpcProvider(rpcUrl) : null
31
- const wallet = new ethers.Wallet(privateKey, provider)
32
-
33
- const token = new ethers.Contract(tx.tokenAddress, ERC20_ABI, wallet)
34
- return token.transfer(tx.to, tx.value)
35
- }
36
-
37
- export async function signNativeTransfer({
38
- toAddress,
39
- amount,
40
- privateKey,
41
- rpcUrl
42
- }: {
43
- toAddress: string
44
- amount: bigint
45
- privateKey: string
46
- rpcUrl: string
47
- }): Promise<string> {
48
- const provider = new ethers.JsonRpcProvider(rpcUrl)
49
-
50
- const network = await provider.getNetwork()
51
- const wallet = new ethers.Wallet(privateKey)
52
- const nonce = await provider.getTransactionCount(await wallet.getAddress())
53
-
54
- const tx = {
55
- to: toAddress,
56
- value: amount,
57
- chainId: network.chainId,
58
- nonce: nonce,
59
- gasLimit: 21000n,
60
- maxFeePerGas: ethers.parseUnits('50', 'gwei'),
61
- maxPriorityFeePerGas: ethers.parseUnits('2', 'gwei')
62
- }
63
-
64
- const signedTx = await wallet.signTransaction(tx)
65
- return signedTx
66
- }
67
-
68
- export async function signERC20Transfer({
69
- tokenAddress,
70
- toAddress,
71
- amount,
72
- privateKey,
73
- rpcUrl
74
- }: {
75
- tokenAddress: string
76
- toAddress: string
77
- amount: bigint
78
- privateKey: string
79
- rpcUrl: string
80
- }): Promise<string> {
81
- const provider = new ethers.JsonRpcProvider(rpcUrl)
82
-
83
- const network = await provider.getNetwork()
84
- const wallet = new ethers.Wallet(privateKey)
85
- const nonce = await provider.getTransactionCount(await wallet.getAddress())
86
-
87
- const erc20Interface = new ethers.Interface(ERC20_ABI)
88
- const data = erc20Interface.encodeFunctionData('transfer', [
89
- toAddress,
90
- amount
91
- ])
92
-
93
- const tx = {
94
- to: tokenAddress,
95
- value: 0n,
96
- data: data,
97
- chainId: network.chainId,
98
- nonce: nonce,
99
- gasLimit: 65000n,
100
- maxFeePerGas: ethers.parseUnits('50', 'gwei'),
101
- maxPriorityFeePerGas: ethers.parseUnits('2', 'gwei')
102
- }
103
-
104
- const signedTx = await wallet.signTransaction(tx)
105
- return signedTx
106
- }
107
-
108
- export async function signTypedData(
109
- privateKey: string,
110
- txData: SimpleMultisigTransactionData,
111
- rpcUrl?: string
112
- ): Promise<string> {
113
- const provider = rpcUrl ? new ethers.JsonRpcProvider(rpcUrl) : null
114
- const wallet = new ethers.Wallet(privateKey, provider)
115
-
116
- const signature = await wallet.signTypedData(
117
- txData.domain,
118
- { MultiSigTransaction: txData.types.MultiSigTransaction },
119
- {
120
- ...txData.message,
121
- value:
122
- txData.message.value === '0x'
123
- ? BigInt(0)
124
- : BigInt(txData.message.value),
125
- nonce: parseInt(txData.message.nonce as any)
126
- }
127
- )
128
-
129
- return signature
130
- }
131
-
132
- export async function sha256(message: string) {
133
- const encoder = new TextEncoder()
134
- const data = encoder.encode(message)
135
-
136
- const hashBuffer = await crypto.subtle.digest('SHA-256', data)
137
-
138
- const hashArray = Array.from(new Uint8Array(hashBuffer))
139
- const hashHex = hashArray
140
- .map((b) => b.toString(16).padStart(2, '0'))
141
- .join('')
142
-
143
- return hashHex
144
- }
@@ -1,38 +0,0 @@
1
- import DeviceInfo from 'react-native-device-info'
2
-
3
- export type Platform = 'web' | 'react-native' | 'unknown'
4
-
5
- function detectPlatform(): Platform {
6
- if (typeof window !== 'undefined' && typeof document !== 'undefined') {
7
- return 'web'
8
- }
9
- if (
10
- typeof navigator !== 'undefined' &&
11
- navigator.product === 'ReactNative'
12
- ) {
13
- return 'react-native'
14
- }
15
-
16
- return 'unknown'
17
- }
18
-
19
- export async function getUserAgent() {
20
- return DeviceInfo.getUserAgent()
21
- }
22
-
23
- export async function getDeviceId(): Promise<string> {
24
- return DeviceInfo.getUniqueId()
25
- }
26
-
27
- export async function getBundleId() {
28
- const platform = detectPlatform()
29
-
30
- switch (platform) {
31
- case 'web':
32
- return location.origin
33
- case 'react-native':
34
- return DeviceInfo.getBundleId()
35
- default:
36
- return 'Unknown'
37
- }
38
- }
@@ -1,58 +0,0 @@
1
- import { ERC20Transaction, NativeTransaction } from './types/Transaction'
2
- import { HttpClient } from '../HttpClient'
3
-
4
- type Headers = { [key: string]: string }
5
-
6
- export class DoraApiClient {
7
- http: HttpClient
8
- headers: Headers = {
9
- 'Content-Type': 'application/json',
10
- Accept: 'application/json'
11
- }
12
-
13
- constructor() {
14
- const doraUrl = 'https://dora.testnet.ethpar.net/api'
15
- this.http = new HttpClient(doraUrl, this.headers)
16
- }
17
-
18
- getTransactions = (
19
- address: string,
20
- params?: { offset: number; size: number }
21
- ): Promise<{
22
- data: NativeTransaction[]
23
- totalCount: number
24
- pageSize: number
25
- offset: number
26
- }> => {
27
- if (!params) {
28
- params = {
29
- offset: 0,
30
- size: 1000
31
- }
32
- }
33
- return this.http.get(
34
- `/account/txlist/${address}?offset=${params.offset}&pageSize=${params.size}`
35
- )
36
- }
37
-
38
- getERC20Transactions = (
39
- address: string,
40
- contract: string,
41
- params?: { offset: number; size: number }
42
- ): Promise<{
43
- data: ERC20Transaction[]
44
- totalCount: number
45
- pageSize: number
46
- offset: number
47
- }> => {
48
- if (!params) {
49
- params = {
50
- offset: 0,
51
- size: 1000
52
- }
53
- }
54
- return this.http.get(
55
- `/account/txlist/erc20/${address}?contract=${contract}?offset=${params.offset}&pageSize=${params.size}`
56
- )
57
- }
58
- }
package/src/dora/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export { DoraApiClient } from './DoraApiClient'
2
- import {
3
- ERC20Transaction,
4
- NativeTransaction,
5
- Transaction
6
- } from './types/Transaction'