llama-pay-sdk 1.0.0

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 (76) hide show
  1. package/lib/data/DoraApiClient.d.ts +30 -0
  2. package/lib/data/DoraApiClient.d.ts.map +1 -0
  3. package/lib/data/DoraApiClient.js +34 -0
  4. package/lib/data/DoraApiClient.js.map +1 -0
  5. package/lib/data/HttpClient.d.ts +30 -0
  6. package/lib/data/HttpClient.d.ts.map +1 -0
  7. package/lib/data/HttpClient.js +75 -0
  8. package/lib/data/HttpClient.js.map +1 -0
  9. package/lib/data/MerapiClient.d.ts +77 -0
  10. package/lib/data/MerapiClient.d.ts.map +1 -0
  11. package/lib/data/MerapiClient.js +106 -0
  12. package/lib/data/MerapiClient.js.map +1 -0
  13. package/lib/index.d.ts +13 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +8 -0
  16. package/lib/index.js.map +1 -0
  17. package/lib/models/Balance.d.ts +16 -0
  18. package/lib/models/Balance.d.ts.map +1 -0
  19. package/lib/models/Balance.js +3 -0
  20. package/lib/models/Balance.js.map +1 -0
  21. package/lib/models/FeatureFlags.d.ts +5 -0
  22. package/lib/models/FeatureFlags.d.ts.map +1 -0
  23. package/lib/models/FeatureFlags.js +3 -0
  24. package/lib/models/FeatureFlags.js.map +1 -0
  25. package/lib/models/IBinInfo.d.ts +25 -0
  26. package/lib/models/IBinInfo.d.ts.map +1 -0
  27. package/lib/models/IBinInfo.js +3 -0
  28. package/lib/models/IBinInfo.js.map +1 -0
  29. package/lib/models/IMultisigWallet.d.ts +36 -0
  30. package/lib/models/IMultisigWallet.d.ts.map +1 -0
  31. package/lib/models/IMultisigWallet.js +3 -0
  32. package/lib/models/IMultisigWallet.js.map +1 -0
  33. package/lib/models/ITokenInfo.d.ts +10 -0
  34. package/lib/models/ITokenInfo.d.ts.map +1 -0
  35. package/lib/models/ITokenInfo.js +3 -0
  36. package/lib/models/ITokenInfo.js.map +1 -0
  37. package/lib/models/ITransaction.d.ts +40 -0
  38. package/lib/models/ITransaction.d.ts.map +1 -0
  39. package/lib/models/ITransaction.js +3 -0
  40. package/lib/models/ITransaction.js.map +1 -0
  41. package/lib/models/IUser.d.ts +10 -0
  42. package/lib/models/IUser.d.ts.map +1 -0
  43. package/lib/models/IUser.js +3 -0
  44. package/lib/models/IUser.js.map +1 -0
  45. package/lib/models/SimpleMultisigTransactionData.d.ts +29 -0
  46. package/lib/models/SimpleMultisigTransactionData.d.ts.map +1 -0
  47. package/lib/models/SimpleMultisigTransactionData.js +3 -0
  48. package/lib/models/SimpleMultisigTransactionData.js.map +1 -0
  49. package/lib/models/Transaction.d.ts +30 -0
  50. package/lib/models/Transaction.d.ts.map +1 -0
  51. package/lib/models/Transaction.js +3 -0
  52. package/lib/models/Transaction.js.map +1 -0
  53. package/lib/models/Wallet.d.ts +15 -0
  54. package/lib/models/Wallet.d.ts.map +1 -0
  55. package/lib/models/Wallet.js +3 -0
  56. package/lib/models/Wallet.js.map +1 -0
  57. package/lib/util.d.ts +9 -0
  58. package/lib/util.d.ts.map +1 -0
  59. package/lib/util.js +72 -0
  60. package/lib/util.js.map +1 -0
  61. package/package.json +27 -0
  62. package/src/data/DoraApiClient.ts +58 -0
  63. package/src/data/HttpClient.ts +125 -0
  64. package/src/data/MerapiClient.ts +194 -0
  65. package/src/index.ts +29 -0
  66. package/src/models/Balance.ts +16 -0
  67. package/src/models/FeatureFlags.ts +4 -0
  68. package/src/models/IBinInfo.ts +24 -0
  69. package/src/models/IMultisigWallet.ts +40 -0
  70. package/src/models/ITokenInfo.ts +9 -0
  71. package/src/models/ITransaction.ts +47 -0
  72. package/src/models/IUser.ts +9 -0
  73. package/src/models/SimpleMultisigTransactionData.ts +28 -0
  74. package/src/models/Transaction.ts +31 -0
  75. package/src/models/Wallet.ts +17 -0
  76. package/tsconfig.json +18 -0
@@ -0,0 +1,16 @@
1
+ import { ITokenInfo } from './ITokenInfo'
2
+
3
+ export type Balance = ITokenInfo & Partial<TokenPrice> & { amount: string }
4
+
5
+ export type TokenPrice = {
6
+ currentValue: number
7
+ currentPrice: number
8
+ priceChangePercentange24h: number
9
+ }
10
+
11
+ export type BalanceResponse = {
12
+ amount: string
13
+ tokenAddress: string | null
14
+ currentPrice: number
15
+ priceChangePercentange24h: number
16
+ }
@@ -0,0 +1,4 @@
1
+ export interface FeatureFlags {
2
+ multisignatureWallet: boolean
3
+ paymentWallet: boolean
4
+ }
@@ -0,0 +1,24 @@
1
+ export type BinInfo = {
2
+ number?: {
3
+ length: number
4
+ luhn: boolean
5
+ }
6
+ scheme?: string
7
+ type?: string
8
+ brand?: string
9
+ country?: {
10
+ numeric: string
11
+ alpha2: string
12
+ name: string
13
+ emoji: string
14
+ currency: string
15
+ latitude: number
16
+ longitude: number
17
+ }
18
+ bank?: {
19
+ name: string
20
+ url?: string
21
+ phone?: string
22
+ city?: string
23
+ }
24
+ }
@@ -0,0 +1,40 @@
1
+ import { BinInfo } from './IBinInfo'
2
+
3
+ export interface IMultisigWallet {
4
+ address: string
5
+ m: number
6
+ n: number
7
+ executorAddress: string | null
8
+ signers: ISigner[]
9
+ creationHash?: string
10
+ }
11
+
12
+ export interface ISigner {
13
+ id: string
14
+ address: string
15
+ userId: string | null
16
+ acceptedOn: Date | null
17
+ }
18
+
19
+ export type IBaseMultisigWallet = {
20
+ id: string
21
+ name: string
22
+ userId: string
23
+ wallet: IMultisigWallet
24
+ createdOn: Date
25
+ }
26
+
27
+ export type ICreditCardMultisigWallet = IBaseMultisigWallet & {
28
+ panLastDigits: string
29
+ panHash: string
30
+ binHash: string
31
+ binInfo: BinInfo | null
32
+ type: 'credit-card'
33
+ }
34
+
35
+ export type IGeneralMultisigWallet = IBaseMultisigWallet & {
36
+ creatorId: string
37
+ type: 'general'
38
+ signerIds: (string | null)[]
39
+ signerAddresses: string[]
40
+ }
@@ -0,0 +1,9 @@
1
+ export interface ITokenInfo {
2
+ tokenAddress: string | null
3
+ imageUrl: string
4
+ token: {
5
+ name: string
6
+ decimals: number
7
+ symbol: string
8
+ }
9
+ }
@@ -0,0 +1,47 @@
1
+ import { SimpleMultisigTransactionData } from './SimpleMultisigTransactionData'
2
+
3
+ export interface ITransaction {
4
+ id: string
5
+ assetType: AssetType
6
+ asset: TransactionAsset
7
+ amount: string
8
+ to: string
9
+ walletId: string
10
+ initiatorUserId: string | null
11
+ executorAddress: string | null
12
+ signatures: ISignature[]
13
+ status: 'pending' | 'completed' | 'failed'
14
+ data: SimpleMultisigTransactionData
15
+ hash: string | null
16
+ fee: FeeQuote
17
+ createdOn: Date
18
+ updatedOn: Date
19
+ remark: string | null
20
+ type: 'normal' | 'merchant'
21
+
22
+ // applicable only for merchant
23
+ merchant: string | null
24
+ }
25
+
26
+ export type AssetType = 'native' | 'erc20'
27
+
28
+ export type TransactionAsset = {
29
+ tokenAddress: string | null
30
+ symbol: string
31
+ decimals: number
32
+ image: string | null
33
+ }
34
+
35
+ export type FeeQuote = {
36
+ gasLimit: string
37
+ maxFeePerGas: string | null
38
+ maxPriorityFeePerGas: string | null
39
+
40
+ gasPrice: string | null
41
+ totalWei: string | null
42
+ }
43
+
44
+ export interface ISignature {
45
+ address: string
46
+ signature: string
47
+ }
@@ -0,0 +1,9 @@
1
+ export type IUser = {
2
+ id: string | number
3
+ email: string
4
+ phone: string | null
5
+ name: string | null
6
+ publicAddress: string | null
7
+ createdOn: string
8
+ updatedOn: string
9
+ }
@@ -0,0 +1,28 @@
1
+ export type SimpleMultisigTransactionData = {
2
+ types: {
3
+ EIP712Domain: {
4
+ name: string
5
+ type: string
6
+ }[]
7
+ MultiSigTransaction: {
8
+ name: string
9
+ type: string
10
+ }[]
11
+ }
12
+ domain: {
13
+ name: string
14
+ version: string
15
+ chainId: number
16
+ verifyingContract: string
17
+ salt: string
18
+ }
19
+ primaryType: string
20
+ message: {
21
+ executor: string
22
+ nonce: number
23
+ gasLimit: number
24
+ destination: string
25
+ value: string
26
+ data: string
27
+ }
28
+ }
@@ -0,0 +1,31 @@
1
+ export type Transaction = {
2
+ hash: string
3
+ created_at: string
4
+ from: string
5
+ to: string
6
+ value: string
7
+ is_from: boolean
8
+ tokenSymbol: string
9
+ tokenAddress?: string
10
+ }
11
+
12
+ export type NativeTransaction = {
13
+ hash: string
14
+ created_at: string
15
+ from: string
16
+ to: string
17
+ value: string
18
+ is_from: boolean
19
+ }
20
+
21
+ export type ERC20Transaction = {
22
+ hash: string
23
+ method: string
24
+ created_at: string
25
+ from: string
26
+ to: string
27
+ amount: string
28
+ is_from: boolean
29
+ token: string // tokenSymbol
30
+ contract: string
31
+ }
@@ -0,0 +1,17 @@
1
+ export type HDWallet = {
2
+ id: string
3
+ name: string
4
+ mnemonic: string
5
+ }
6
+
7
+ export type Account = {
8
+ id: string
9
+ name: string
10
+ address: string
11
+ type: 'hd' | 'single'
12
+
13
+ // only for hd wallet accounts
14
+ walletId?: string
15
+ privateKey?: string
16
+ derivationPath?: string
17
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "outDir": "./lib",
6
+ "rootDir": "./src",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "emitDeclarationOnly": false,
10
+ "sourceMap": true,
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true
14
+ },
15
+ "include": [
16
+ "src/**/*"
17
+ ]
18
+ }