rango-sdk 0.0.8 → 0.0.10

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 (67) hide show
  1. package/lib/index.d.ts +2 -2
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +8 -21
  4. package/lib/rango-sdk.cjs.development.js +609 -0
  5. package/lib/rango-sdk.cjs.development.js.map +1 -0
  6. package/lib/rango-sdk.cjs.production.min.js +2 -0
  7. package/lib/rango-sdk.cjs.production.min.js.map +1 -0
  8. package/lib/rango-sdk.esm.js +608 -0
  9. package/lib/rango-sdk.esm.js.map +1 -0
  10. package/lib/services/client.d.ts +18 -18
  11. package/lib/services/client.d.ts.map +1 -1
  12. package/lib/services/httpService.d.ts +1 -1
  13. package/lib/services/httpService.d.ts.map +1 -1
  14. package/lib/services/index.d.ts +1 -1
  15. package/lib/services/index.d.ts.map +1 -1
  16. package/lib/types/api/balance.d.ts +1 -38
  17. package/lib/types/api/balance.d.ts.map +1 -1
  18. package/lib/types/api/common.d.ts +1 -222
  19. package/lib/types/api/common.d.ts.map +1 -1
  20. package/lib/types/api/meta.d.ts +1 -165
  21. package/lib/types/api/meta.d.ts.map +1 -1
  22. package/lib/types/api/routing.d.ts +1 -143
  23. package/lib/types/api/routing.d.ts.map +1 -1
  24. package/lib/types/api/transactions.d.ts +1 -180
  25. package/lib/types/api/transactions.d.ts.map +1 -1
  26. package/lib/types/api/txs/cosmos.d.ts +1 -65
  27. package/lib/types/api/txs/cosmos.d.ts.map +1 -1
  28. package/lib/types/api/txs/evm.d.ts +1 -28
  29. package/lib/types/api/txs/evm.d.ts.map +1 -1
  30. package/lib/types/api/txs/index.d.ts +4 -4
  31. package/lib/types/api/txs/index.d.ts.map +1 -1
  32. package/lib/types/api/txs/solana.d.ts +1 -45
  33. package/lib/types/api/txs/solana.d.ts.map +1 -1
  34. package/lib/types/api/txs/transfer.d.ts +1 -23
  35. package/lib/types/api/txs/transfer.d.ts.map +1 -1
  36. package/lib/types/index.d.ts +6 -6
  37. package/lib/types/index.d.ts.map +1 -1
  38. package/package.json +21 -20
  39. package/lib/index.js.map +0 -1
  40. package/lib/services/client.js +0 -164
  41. package/lib/services/client.js.map +0 -1
  42. package/lib/services/httpService.js +0 -11
  43. package/lib/services/httpService.js.map +0 -1
  44. package/lib/services/index.js +0 -6
  45. package/lib/services/index.js.map +0 -1
  46. package/lib/types/api/balance.js +0 -3
  47. package/lib/types/api/balance.js.map +0 -1
  48. package/lib/types/api/common.js +0 -3
  49. package/lib/types/api/common.js.map +0 -1
  50. package/lib/types/api/meta.js +0 -3
  51. package/lib/types/api/meta.js.map +0 -1
  52. package/lib/types/api/routing.js +0 -3
  53. package/lib/types/api/routing.js.map +0 -1
  54. package/lib/types/api/transactions.js +0 -23
  55. package/lib/types/api/transactions.js.map +0 -1
  56. package/lib/types/api/txs/cosmos.js +0 -3
  57. package/lib/types/api/txs/cosmos.js.map +0 -1
  58. package/lib/types/api/txs/evm.js +0 -3
  59. package/lib/types/api/txs/evm.js.map +0 -1
  60. package/lib/types/api/txs/index.js +0 -21
  61. package/lib/types/api/txs/index.js.map +0 -1
  62. package/lib/types/api/txs/solana.js +0 -3
  63. package/lib/types/api/txs/solana.js.map +0 -1
  64. package/lib/types/api/txs/transfer.js +0 -3
  65. package/lib/types/api/txs/transfer.js.map +0 -1
  66. package/lib/types/index.js +0 -23
  67. package/lib/types/index.js.map +0 -1
@@ -1,144 +1,2 @@
1
- import type { Amount, Asset, SwapResult } from './common';
2
- import type { TransactionType } from './transactions';
3
- /**
4
- * All user wallets for a specific blockchain
5
- *
6
- * @property {string} blockchain - The blockchain that wallets belong to
7
- * @property {string[]} addresses - List of user wallet addresses for the specified blockchain
8
- *
9
- */
10
- export declare type UserWalletBlockchain = {
11
- blockchain: string;
12
- addresses: string[];
13
- };
14
- /**
15
- * Full information of a path of multiple swaps that should be executed by user to swap X to Y
16
- *
17
- * @property {string} outputAmount - The estimation of Rango from output amount of Y
18
- * @property {'OK' | 'HIGH_IMPACT' | 'NO_ROUTE' | 'INPUT_LIMIT_ISSUE'} resultType
19
- * @property {SwapResult[]} swaps - List of required swaps to swap X to Y with the expected outputAmount
20
- *
21
- */
22
- export declare type SimulationResult = {
23
- outputAmount: string;
24
- resultType: 'OK' | 'HIGH_IMPACT' | 'NO_ROUTE' | 'INPUT_LIMIT_ISSUE';
25
- swaps: SwapResult[];
26
- };
27
- /**
28
- * Describing a required Asset for swapping X to Y and check if the wallet has enough balance or not
29
- *
30
- * @property {Asset} asset - asset required for fee or balance
31
- * @property {Asset} requiredAmount
32
- * @property {Amount} currentAmount
33
- * @property {boolean} ok - If true, means this requirement is fulfilled, false means swap may fail due to insufficient balance
34
- * @property {string} reason - 'FEE' | 'FEE_AND_INPUT_ASSET' | 'INPUT_ASSET'
35
- *
36
- */
37
- export declare type WalletRequiredAssets = {
38
- asset: Asset;
39
- requiredAmount: Amount;
40
- currentAmount: Amount;
41
- ok: boolean;
42
- reason: 'FEE' | 'FEE_AND_INPUT_ASSET' | 'INPUT_ASSET';
43
- };
44
- /**
45
- * The validation status of a wallet
46
- *
47
- * @property {string} address - The address of wallet
48
- * @property {boolean} addressIsValid - If false, the wallet address is invalid for the given blockchain
49
- * @property {WalletRequiredAssets[]} requiredAssets - The list of required assets for swapping X to Y in this wallet
50
- * and the status to indicate whether these assets are missing or not
51
- * @property {boolean} validResult - If false, Rango was unable to fetch the balance of this address to check the
52
- * requiredAssets availability
53
- *
54
- */
55
- export declare type WalletValidationStatus = {
56
- address: string;
57
- addressIsValid: boolean;
58
- requiredAssets: WalletRequiredAssets[];
59
- validResult: boolean;
60
- };
61
- /**
62
- * The blockchain that this validation data belongs to
63
- *
64
- * @property {string} blockchain - The blockchain of validation
65
- * @property {WalletValidationStatus[]} wallets - The status of validation for all the wallets of the specific blockchain
66
- *
67
- */
68
- export declare type BlockchainValidationStatus = {
69
- blockchain: string;
70
- wallets: WalletValidationStatus[];
71
- };
72
- /**
73
- * Body of routing request
74
- *
75
- * @property {Asset} from - The source asset
76
- * @property {Asset} to - The destination asset
77
- * @property {string} amount - The human-readable amount of asset X that is going to be swapped, example: 0.28
78
- * @property {{ [key: string]: string }} selectedWallets - Map of blockchain to selected address
79
- * @property {UserWalletBlockchain[]} connectedWallets - List of all user connected wallet addresses per each blockchain
80
- * @property {boolean} checkPrerequisites - It should be false when client just likes to preview the route to user,
81
- * and true when user really accepted to swap. If true, server will be much slower to respond, but will check some
82
- * pre-requisites including balance of X and required fees in user's wallets
83
- * @property {boolean} [forceExecution] - Use this flag if you want to ignore checkPrerequisites before executing the route
84
- * @property {string | null} [affiliateRef] - The affiliate ref that client likes to send to Rango, so in cases of
85
- * 1inch, Thorchain, etc. that support affiliation, the referrer will earn some money if user accept the route and
86
- * signs the transactions. example: K3ldk3
87
- * @property {boolean} [disableMultiStepTx] - It should be true when the client doesn't want multi-step transactions
88
- * @property {string[]} [blockchains] - List of all accepted blockchains, an empty list means no filter is required
89
- * @property {string[]} [swappers] - List of all accepted swappers, an empty list means no filter is required
90
- * @property {string[]} [transactionTypes] - List of all accepted transaction types including [EVM, TRANSFER, COSMOS]
91
- * @property {number} [maxLength] - Maximum number of steps in a route
92
- *
93
- */
94
- export declare type BestRouteRequest = {
95
- from: Asset;
96
- to: Asset;
97
- amount: string;
98
- connectedWallets: UserWalletBlockchain[];
99
- selectedWallets: {
100
- [key: string]: string;
101
- };
102
- checkPrerequisites: boolean;
103
- forceExecution?: boolean;
104
- affiliateRef?: string | null;
105
- disableMultiStepTx?: boolean;
106
- blockchains?: string[];
107
- swappers?: string[];
108
- transactionTypes?: TransactionType[];
109
- maxLength?: number;
110
- };
111
- /**
112
- * The response of best route, if the result fields is null, it means that no route is found
113
- *
114
- * @property {string} requestId - The unique requestId which is generated for this request by the server. It should be
115
- * passed down to all other endpoints if this swap continues on. e.g. d10657ce-b13a-405c-825b-b47f8a5016ad
116
- * @property {string} requestAmount - The human readable input amount from the request
117
- * @property {Asset} from
118
- * @property {Asset} to
119
- * @property {SimulationResult | null} result
120
- * @property {BlockchainValidationStatus[] | null} validationStatus - Pre-requisites check result. It will be null if
121
- * the request checkPrerequisites was false
122
- * @property {string[]} diagnosisMessages - list of string messages that might be cause of not finding the route.
123
- * It's just for display purposes
124
- * @property {string[]} missingBlockchains - List of all blockchains which are necessary to be present for the best
125
- * route and user has not provided any connected wallets for it. A null or empty list indicates that there is no problem.
126
- * @property {boolean} processingLimitReached - A warning indicates that it took too much time to find the best
127
- * route and the server could not find any routes from X to Y
128
- * @property {boolean} walletNotSupportingFromBlockchain - A warning indicates that none of your wallets have the same
129
- * blockchain as X asset
130
- *
131
- */
132
- export declare type BestRouteResponse = {
133
- requestId: string;
134
- requestAmount: string;
135
- from: Asset;
136
- to: Asset;
137
- result: SimulationResult | null;
138
- validationStatus: BlockchainValidationStatus[] | null;
139
- diagnosisMessages: string[] | null;
140
- missingBlockchains: string[] | null;
141
- processingLimitReached: boolean;
142
- walletNotSupportingFromBlockchain: boolean;
143
- };
1
+ export * from 'rango-types/lib/api/main/routing';
144
2
  //# sourceMappingURL=routing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../../src/types/api/routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD;;;;;;GAMG;AACH,oBAAY,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED;;;;;;;GAOG;AACH,oBAAY,gBAAgB,GAAG;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,IAAI,GAAG,aAAa,GAAG,UAAU,GAAG,mBAAmB,CAAA;IACnE,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED;;;;;;;;;GAS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B,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,KAAK,CAAA;IACX,EAAE,EAAE,KAAK,CAAA;IACT,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC/B,gBAAgB,EAAE,0BAA0B,EAAE,GAAG,IAAI,CAAA;IACrD,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAClC,kBAAkB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACnC,sBAAsB,EAAE,OAAO,CAAA;IAC/B,iCAAiC,EAAE,OAAO,CAAA;CAC3C,CAAA"}
1
+ {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/types/api/routing.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA"}
@@ -1,181 +1,2 @@
1
- /**
2
- * The type of transaction
3
- */
4
- export declare enum TransactionType {
5
- EVM = "EVM",
6
- TRANSFER = "TRANSFER",
7
- COSMOS = "COSMOS",
8
- SOLANA = "SOLANA"
9
- }
10
- /**
11
- * Parent model for all types of transactions
12
- * Check EvmTransaction, TransferTransaction and CosmosTransaction models for more details
13
- *
14
- */
15
- export declare type GenericTransaction = {
16
- type: TransactionType;
17
- };
18
- /**
19
- * Data of referral rewards of a transaction
20
- *
21
- * @property {string} blockChain - The blockchain that reward is generated in, example: BSC
22
- * @property {string | null} address - The smart contract address of rewarded asset, null for native assets
23
- * @property {string} symbol - The symbol of the asset that is rewarded, example: ADA
24
- * @property {number} decimals - The decimals of the rewarded asset, example: 18
25
- * @property {string} amount - The machine-readable amount of the reward, example: 1000000000000000000
26
- *
27
- */
28
- export declare type TransactionStatusReferral = {
29
- blockChain: string;
30
- address: string | null;
31
- symbol: string;
32
- decimals: number;
33
- amount: string;
34
- };
35
- /**
36
- * Settings of user for swaps
37
- *
38
- * @property {string} slippage - Amount of users' preferred slippage in percent
39
- *
40
- */
41
- export declare type UserSettings = {
42
- slippage: string;
43
- };
44
- /**
45
- * List of validations that Rango should do
46
- *
47
- * @property {boolean} balance - If true [Recommended], Rango will check that user has the required balance for swap
48
- * @property {boolean} fee - If true [Recommended], Rango will check that user has the required fees in the wallet
49
- *
50
- */
51
- export declare type CreateTransactionValidation = {
52
- balance: boolean;
53
- fee: boolean;
54
- };
55
- /**
56
- * A transaction's url that can be displayed to advanced user to track the progress
57
- *
58
- * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...
59
- * @property {string | null} description - A custom display name to help user distinguish the transactions from each
60
- * other. Example: Inbound, Outbound, Bridge, or null
61
- *
62
- */
63
- export declare type SwapExplorerUrl = {
64
- description: string | null;
65
- url: string;
66
- };
67
- /**
68
- * Request body of check tx status
69
- *
70
- * @property {string} requestId - The unique ID which is generated in the best route endpoint
71
- * @property {number} step - 1-based step number of a complex multi-step swap, example: 1, 2, ...
72
- * @property {number} txId - Tx hash that wallet returned, example: 0xa1a37ce2063c4764da27d990a22a0c89ed8ac585286a77a...
73
- *
74
- */
75
- export declare type CheckTxStatusRequest = {
76
- requestId: string;
77
- step: number;
78
- txId: string;
79
- };
80
- /**
81
- * Request body of createTransaction endpoint
82
- *
83
- * @property {string} requestId - The unique ID which is generated in the best route endpoint
84
- * @property {number} step - 1-based step number of a complex multi-step swap, example: 1, 2, ...
85
- * @property {UserSettings} userSettings - user settings for the swap
86
- * @property {CreateTransactionValidation} validations - the validation checks we are interested to check by Rango
87
- * before starting the swap
88
- *
89
- */
90
- export declare type CreateTransactionRequest = {
91
- requestId: string;
92
- step: number;
93
- userSettings: UserSettings;
94
- validations: CreateTransactionValidation;
95
- };
96
- /**
97
- * Data of the event including its type and an extra metadata
98
- * It should be used when an error happened in client and we want to inform server that transaction failed,
99
- * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.
100
- *
101
- * @property {string} requestId - The requestId from best route endpoint
102
- * @property {string} eventType - Type of the event that happened, example: TX_FAIL
103
- * @property {[key: string]: string} data - A list of key-value for extra details
104
- *
105
- */
106
- export declare type ReportTransactionRequest = {
107
- requestId: string;
108
- eventType: 'TX_FAIL';
109
- data: {
110
- [key: string]: string;
111
- };
112
- };
113
- /**
114
- * The status of transaction in tracking
115
- */
116
- export declare enum TransactionStatus {
117
- FAILED = "failed",
118
- RUNNING = "running",
119
- SUCCESS = "success"
120
- }
121
- /**
122
- * The swapper details for a transaction step
123
- */
124
- export declare type SwapperStatusStep = {
125
- name: string;
126
- state: 'PENDING' | 'CREATED' | 'WAITING' | 'SIGNED' | 'SUCCESSED' | 'FAILED';
127
- current: boolean;
128
- };
129
- /**
130
- * Response of check transaction status containing the latest status of transaction
131
- *
132
- * @property {TransactionStatus | null} status - Status of the transaction, while the status is running or null, the
133
- * client should retry until it turns into success or failed
134
- * @property {number} timestamp - The timestamp of the executed transaction. Beware that timestamp can be null even if
135
- * the status is successful or failed, example: 1635271424813
136
- * @property {string | null} extraMessage - A message in case of failure, that could be shown to the user
137
- * @property {string | null} outputAmount - The output amount of the transaction if it was successful, exmaple: 0.28
138
- * @property {GenericTransaction | null} newTx - if a transaction needs more than one-step transaction to be signed by
139
- * the user, the next step transaction will be returned in this field.
140
- * @property {string | null} diagnosisUrl - In some special cases [e.g. AnySwap], the user should follow some steps
141
- * outside Rango to get its assets back (refund). You can show this link to the user to help him
142
- * @property {SwapExplorerUrl[] | null} explorerUrl - List of explorer URLs for the transactions that happened in this step.
143
- * @property {TransactionStatusReferral[] | null} referrals - List of referral reward for the dApp and Rango
144
- * @property {SwapperStatusStep[] | null} steps - Internal steps details of a route step, used for solana
145
- *
146
- */
147
- export declare type TransactionStatusResponse = {
148
- status: TransactionStatus | null;
149
- timestamp: number | null;
150
- extraMessage: string | null;
151
- outputAmount: string | null;
152
- newTx: GenericTransaction | null;
153
- diagnosisUrl: string | null;
154
- explorerUrl: SwapExplorerUrl[] | null;
155
- referrals: TransactionStatusReferral[] | null;
156
- steps: SwapperStatusStep[] | null;
157
- };
158
- /**
159
- * Response body of check-approval
160
- *
161
- * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not
162
- *
163
- */
164
- export declare type CheckApprovalResponse = {
165
- isApproved: boolean;
166
- };
167
- /**
168
- * Response body of create transaction, to see a list of example transactions
169
- * @see https://rango.exchange/apis/docs/tx-example
170
- *
171
- * @property {string | null} error - Error message about the incident if ok == false
172
- * @property {boolean} ok - If true, Rango has created a non-null transaction and the error message is null
173
- * @property {GenericTransaction | null} transaction - Transaction's raw data
174
- *
175
- */
176
- export declare type CreateTransactionResponse = {
177
- error: string | null;
178
- ok: boolean;
179
- transaction: GenericTransaction | null;
180
- };
1
+ export * from 'rango-types/lib/api/main/transactions';
181
2
  //# sourceMappingURL=transactions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../../src/types/api/transactions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAA;CACtB,CAAA;AAED;;;;;;;;;GASG;AACH,oBAAY,yBAAyB,GAAG;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;GAKG;AACH,oBAAY,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;GAMG;AACH,oBAAY,2BAA2B,GAAG;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;CACb,CAAA;AAED;;;;;;;GAOG;AACH,oBAAY,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED;;;;;;;GAO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KAAK,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAA;CAClC,CAAA;AAED;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG;IAClC,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;AACH,oBAAY,yBAAyB,GAAG;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,EAAE,EAAE,OAAO,CAAA;IACX,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAA;CACvC,CAAA"}
1
+ {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/types/api/transactions.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA"}
@@ -1,66 +1,2 @@
1
- import type { AssetWithTicker } from '../common';
2
- import type { GenericTransaction } from '../transactions';
3
- /**
4
- * CosmosCoin representing fee coins
5
- */
6
- export declare type CosmosCoin = {
7
- amount: string;
8
- denom: string;
9
- };
10
- /**
11
- * CosmosStdFee representing fee for cosmos transaction
12
- */
13
- export declare type CosmosStdFee = {
14
- amount: CosmosCoin[];
15
- gas: string;
16
- };
17
- /**
18
- * Main transaction object for COSMOS type transactions (including Terra, Osmosis, ...)
19
- */
20
- export declare type CosmosMessage = {
21
- signType: 'AMINO' | 'DIRECT';
22
- sequence: string | null;
23
- source: number | null;
24
- account_number: number | null;
25
- rpcUrl: string | null;
26
- chainId: string | null;
27
- msgs: any[];
28
- protoMsgs: any[];
29
- memo: string | null;
30
- fee: CosmosStdFee | null;
31
- };
32
- /**
33
- * An alternative to CosmosMessage object for the cosmos wallets that do not support generic Cosmos messages (e.g. XDefi)
34
- *
35
- * @property {AssetWithTicker} asset - The asset to be transferred
36
- * @property {string} amount - The machine-readable amount to transfer, example: 1000000000000000000
37
- * @property {number} decimals - The decimals for this asset, example: 18
38
- * @property {string | null} memo - Memo of transaction, could be null
39
- * @property {string} method - The transaction method, example: transfer, deposit
40
- * @property {string} recipient - The recipient address of transaction
41
- *
42
- */
43
- export declare type CosmosRawTransferData = {
44
- amount: string;
45
- asset: AssetWithTicker;
46
- decimals: number;
47
- memo: string | null;
48
- method: string;
49
- recipient: string;
50
- };
51
- /**
52
- * A Cosmos transaction, child of GenericTransaction
53
- *
54
- * @property {string} blockChain - The blockchain that this transaction will be executed in, same as the input blockchain of creating transaction
55
- * @property {string} fromWalletAddress - Address of wallet that this transaction should be executed in, same as the create transaction request's input
56
- * @property {CosmosMessage} data - Transaction data
57
- * @property {CosmosRawTransferData} rawTransfer - An alternative to CosmosMessage object for the cosmos wallets that do not support generic Cosmos messages
58
- *
59
- */
60
- export interface CosmosTransaction extends GenericTransaction {
61
- blockChain: string;
62
- fromWalletAddress: string;
63
- data: CosmosMessage;
64
- rawTransfer: CosmosRawTransferData;
65
- }
1
+ export * from 'rango-types/lib/api/main/txs/cosmos';
66
2
  //# sourceMappingURL=cosmos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../../../../src/types/api/txs/cosmos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;GAEG;AACH,oBAAY,YAAY,GAAG;IACzB,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED;;GAEG;AACH,oBAAY,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,SAAS,EAAE,GAAG,EAAE,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,GAAG,EAAE,YAAY,GAAG,IAAI,CAAA;CACzB,CAAA;AAED;;;;;;;;;;GAUG;AACH,oBAAY,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,eAAe,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB,EAAE,MAAM,CAAA;IACzB,IAAI,EAAE,aAAa,CAAA;IACnB,WAAW,EAAE,qBAAqB,CAAA;CACnC"}
1
+ {"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../../../src/types/api/txs/cosmos.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA"}
@@ -1,29 +1,2 @@
1
- import type { GenericTransaction } from '../transactions';
2
- /**
3
- * The transaction object for all EVM-based blockchains, including Ethereum, BSC, Polygon, Harmony, etc
4
- *
5
- * @property {boolean} isApprovalTx - Determines that this transaction is an approval transaction or not, if true user
6
- * should approve the transaction and call create transaction endpoint again to get the original tx. Beware that most
7
- * of the fields of this object will be passed directly to the wallet without any change.
8
- * @property {string} blockChain - The blockchain that this transaction is going to run in
9
- * @property {string | null} from - The source wallet address, it can be null
10
- * @property {string} to - Address of destination wallet or the smart contract or token that is going to be called
11
- * @property {string | null} data - The data of smart contract call, it can be null in case of native token transfer
12
- * @property {string | null} value - The amount of transaction in case of native token transfer
13
- * @property {string | null} nonce - The nonce value for transaction
14
- * @property {string | null} gasPrice - The suggested gas price for this transaction
15
- * @property {string | null} gasLimit - The suggested gas limit for this transaction
16
- *
17
- */
18
- export interface EvmTransaction extends GenericTransaction {
19
- isApprovalTx: boolean;
20
- blockChain: string;
21
- from: string | null;
22
- to: string;
23
- data: string | null;
24
- value: string | null;
25
- nonce: string | null;
26
- gasLimit: string | null;
27
- gasPrice: string | null;
28
- }
1
+ export * from 'rango-types/lib/api/main/txs/evm';
29
2
  //# sourceMappingURL=evm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../../../src/types/api/txs/evm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB"}
1
+ {"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../../src/types/api/txs/evm.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA"}
@@ -1,5 +1,5 @@
1
- export * from './evm';
2
- export * from './cosmos';
3
- export * from './transfer';
4
- export * from './solana';
1
+ export * from './evm';
2
+ export * from './cosmos';
3
+ export * from './transfer';
4
+ export * from './solana';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/api/txs/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/api/txs/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
@@ -1,46 +1,2 @@
1
- import type { GenericTransaction } from '../transactions';
2
- /**
3
- * Account metadata used to define instructions
4
- */
5
- export declare type SolanaInstructionKey = {
6
- pubkey: string;
7
- isSigner: boolean;
8
- isWritable: boolean;
9
- };
10
- /**
11
- * Transaction Instruction class
12
- */
13
- export declare type SolanaInstruction = {
14
- keys: SolanaInstructionKey[];
15
- programId: string;
16
- data: number[];
17
- };
18
- /**
19
- * Pair of signature and corresponding public key
20
- */
21
- export declare type SolanaSignature = {
22
- signature: number[];
23
- publicKey: string;
24
- };
25
- /**
26
- * This type of transaction is used for all solana transactions
27
- *
28
- * @property {string} blockChain, equals to SOLANA
29
- * @property {string} from, Source wallet address
30
- * @property {string} identifier, Transaction hash used in case of retry
31
- * @property {string | null} recentBlockhash, A recent blockhash
32
- * @property {SolanaSignature[]} signatures, Signatures for the transaction
33
- * @property {number[] | null} serializedMessage, The byte array of the transaction
34
- * @property {SolanaInstruction[]} instructions, The instructions to atomically execute
35
- *
36
- */
37
- export interface SolanaTransaction extends GenericTransaction {
38
- blockChain: string;
39
- from: string;
40
- identifier: string;
41
- recentBlockhash: string | null;
42
- signatures: SolanaSignature[];
43
- serializedMessage: number[] | null;
44
- instructions: SolanaInstruction[];
45
- }
1
+ export * from 'rango-types/lib/api/main/txs/solana';
46
2
  //# sourceMappingURL=solana.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../../src/types/api/txs/solana.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD;;GAEG;AACH,oBAAY,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;GAEG;AACH,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,oBAAoB,EAAE,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,EAAE,CAAA;CACf,CAAA;AAED;;GAEG;AACH,oBAAY,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAClC,YAAY,EAAE,iBAAiB,EAAE,CAAA;CAClC"}
1
+ {"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../src/types/api/txs/solana.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA"}
@@ -1,24 +1,2 @@
1
- import type { AssetWithTicker } from '../common';
2
- import type { GenericTransaction } from '../transactions';
3
- /**
4
- * TransferTransaction. This type of transaction is used for non-EVM and non-Cosmos blockchains including BTC, LTC, BCH
5
- *
6
- * @property {string} method - The method that should be passed to wallet. examples: deposit, transfer
7
- * @property {AssetWithTicker} asset
8
- * @property {string} amount - The machine-readable amount of transaction, example: 1000000000000000000
9
- * @property {number} decimals - The decimals of the asset
10
- * @property {string} fromWalletAddress - The source wallet address that can sign this transaction
11
- * @property {string} recipientAddress - The destination wallet address that the fund should be sent to
12
- * @property {string | null} memo - The memo of transaction, can be null
13
- *
14
- */
15
- export interface Transfer extends GenericTransaction {
16
- method: string;
17
- asset: AssetWithTicker;
18
- amount: string;
19
- decimals: number;
20
- fromWalletAddress: string;
21
- recipientAddress: string;
22
- memo: string | null;
23
- }
1
+ export * from 'rango-types/lib/api/main/txs/transfer';
24
2
  //# sourceMappingURL=transfer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../../../src/types/api/txs/transfer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAS,SAAQ,kBAAkB;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,eAAe,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB"}
1
+ {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../../src/types/api/txs/transfer.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA"}
@@ -1,7 +1,7 @@
1
- export * from './api/balance';
2
- export * from './api/common';
3
- export * from './api/meta';
4
- export * from './api/routing';
5
- export * from './api/transactions';
6
- export * from './api/txs';
1
+ export * from './api/balance';
2
+ export * from './api/common';
3
+ export * from './api/meta';
4
+ export * from './api/routing';
5
+ export * from './api/transactions';
6
+ export * from './api/txs';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "rango-sdk",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Rango Exchange SDK for dApps",
5
+ "module": "lib/rango-sdk.esm.js",
5
6
  "main": "lib/index.js",
6
- "types": "lib",
7
+ "types": "lib/index.d.ts",
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "git+https://github.com/rango-exchange/rango-sdk.git"
@@ -13,11 +14,12 @@
13
14
  "url": "https://github.com/rango-exchange/rango-sdk/issues"
14
15
  },
15
16
  "scripts": {
16
- "test": "jest --config jestconfig.json",
17
- "build": "tsc",
17
+ "build": "tsdx build --tsconfig ./tsconfig.json && yarn mv:file lib",
18
+ "watch": "tsdx watch",
19
+ "format": "prettier --write ./src",
18
20
  "lint": "eslint */**/*.{js,ts} --quiet --fix",
19
21
  "semantic-release": "semantic-release",
20
- "format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
22
+ "mv:file": "sh ./scripts/post-build.sh"
21
23
  },
22
24
  "keywords": [
23
25
  "Rango Exchange",
@@ -30,25 +32,24 @@
30
32
  ],
31
33
  "author": "rango.exchange",
32
34
  "license": "GPL-3.0",
33
- "devDependencies": {
34
- "@types/jest": "^27.4.0",
35
- "@types/uuid": "^8.3.4",
35
+ "devDependencies": {
36
+ "@rollup/plugin-replace": "^5.0.2",
37
+ "@types/uuid": "^9.0.0",
38
+ "@types/node": "^18.11.18",
36
39
  "@typescript-eslint/eslint-plugin": "^5.9.1",
37
40
  "@typescript-eslint/parser": "^5.9.1",
38
- "eslint": "^8.6.0",
39
- "eslint-config-prettier": "^8.3.0",
40
- "eslint-plugin-import": "^2.25.4",
41
- "eslint-plugin-prettier": "^4.0.0",
42
- "jest": "^27.4.7",
43
- "prettier": "^2.5.1",
44
- "semantic-release": "^19.0.2",
45
- "ts-jest": "^27.1.3",
46
- "typescript": "^4.5.4"
41
+ "eslint": "^8.33.0",
42
+ "eslint-config-prettier": "^8.6.0",
43
+ "eslint-plugin-import": "^2.27.5",
44
+ "eslint-plugin-prettier": "^4.2.1",
45
+ "prettier": "^2.8.3",
46
+ "typescript": "^4.9.4"
47
47
  },
48
48
  "dependencies": {
49
- "axios": "^0.24.0",
50
- "bignumber.js": "^9.0.2",
51
- "uuid": "^8.3.2"
49
+ "axios": "^1.2.6",
50
+ "bignumber.js": "^9.1.1",
51
+ "rango-types": "^0.1.1",
52
+ "uuid": "^9.0.0"
52
53
  },
53
54
  "publishConfig": {
54
55
  "access": "public",
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAwC;AAA/B,uGAAA,WAAW,OAAA;AACpB,0CAAuB"}