rango-sdk-basic 0.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.
- package/LICENSE +674 -0
- package/README.md +25 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/services/client.d.ts +19 -0
- package/lib/services/client.d.ts.map +1 -0
- package/lib/services/client.js +191 -0
- package/lib/services/client.js.map +1 -0
- package/lib/services/httpService.d.ts +2 -0
- package/lib/services/httpService.d.ts.map +1 -0
- package/lib/services/httpService.js +11 -0
- package/lib/services/httpService.js.map +1 -0
- package/lib/services/index.d.ts +2 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +6 -0
- package/lib/services/index.js.map +1 -0
- package/lib/types/api/balance.d.ts +39 -0
- package/lib/types/api/balance.d.ts.map +1 -0
- package/lib/types/api/balance.js +3 -0
- package/lib/types/api/balance.js.map +1 -0
- package/lib/types/api/common.d.ts +117 -0
- package/lib/types/api/common.d.ts.map +1 -0
- package/lib/types/api/common.js +11 -0
- package/lib/types/api/common.js.map +1 -0
- package/lib/types/api/meta.d.ts +61 -0
- package/lib/types/api/meta.d.ts.map +1 -0
- package/lib/types/api/meta.js +3 -0
- package/lib/types/api/meta.js.map +1 -0
- package/lib/types/api/routing.d.ts +31 -0
- package/lib/types/api/routing.d.ts.map +1 -0
- package/lib/types/api/routing.js +3 -0
- package/lib/types/api/routing.js.map +1 -0
- package/lib/types/api/transactions.d.ts +145 -0
- package/lib/types/api/transactions.d.ts.map +1 -0
- package/lib/types/api/transactions.js +22 -0
- package/lib/types/api/transactions.js.map +1 -0
- package/lib/types/api/txs/cosmos.d.ts +68 -0
- package/lib/types/api/txs/cosmos.d.ts.map +1 -0
- package/lib/types/api/txs/cosmos.js +3 -0
- package/lib/types/api/txs/cosmos.js.map +1 -0
- package/lib/types/api/txs/evm.d.ts +29 -0
- package/lib/types/api/txs/evm.d.ts.map +1 -0
- package/lib/types/api/txs/evm.js +3 -0
- package/lib/types/api/txs/evm.js.map +1 -0
- package/lib/types/api/txs/index.d.ts +4 -0
- package/lib/types/api/txs/index.d.ts.map +1 -0
- package/lib/types/api/txs/index.js +20 -0
- package/lib/types/api/txs/index.js.map +1 -0
- package/lib/types/api/txs/transfer.d.ts +26 -0
- package/lib/types/api/txs/transfer.d.ts.map +1 -0
- package/lib/types/api/txs/transfer.js +3 -0
- package/lib/types/api/txs/transfer.js.map +1 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +23 -0
- package/lib/types/index.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Asset, QuoteSimulationResult } from "./common";
|
|
2
|
+
import { Token } from "./meta";
|
|
3
|
+
import { CosmosTransaction, EvmTransaction, Transfer } from "./txs";
|
|
4
|
+
/**
|
|
5
|
+
* The type of transaction
|
|
6
|
+
*/
|
|
7
|
+
export declare enum TransactionType {
|
|
8
|
+
EVM = "EVM",
|
|
9
|
+
TRANSFER = "TRANSFER",
|
|
10
|
+
COSMOS = "COSMOS"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A transaction's url that can be displayed to advanced user to track the progress
|
|
14
|
+
*
|
|
15
|
+
* @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...
|
|
16
|
+
* @property {string | null} description - A custom display name to help user distinguish the transactions from each
|
|
17
|
+
* other. Example: Inbound, Outbound, Bridge, or null
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare type SwapExplorerUrl = {
|
|
21
|
+
description: string | null;
|
|
22
|
+
url: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Request body of check tx status
|
|
26
|
+
*
|
|
27
|
+
* @property {string} requestId - The unique ID which is generated in the best route endpoint
|
|
28
|
+
* @property {number} txId - Tx hash that wallet returned, example: 0xa1a37ce2063c4764da27d990a22a0c89ed8ac585286a77a...
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare type StatusRequest = {
|
|
32
|
+
requestId: string;
|
|
33
|
+
txId: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Request body of swap endpoint
|
|
37
|
+
*
|
|
38
|
+
* @property {Asset} from - The source asset
|
|
39
|
+
* @property {Asset} to - The destination asset
|
|
40
|
+
* @property {string} amount - The human-readable amount of asset X that is going to be swapped, example: 0.28
|
|
41
|
+
* @property {string[]} [swappers] - List of all accepted swappers, an empty list means no filter is required
|
|
42
|
+
* @property {string} fromAddress - User source wallet address
|
|
43
|
+
* @property {string} toAddress - User destination wallet address
|
|
44
|
+
* @property {string | number} referrerAddress - Referrer address
|
|
45
|
+
* @property {string | number} referrerFee - Referrer fee in percent, (e.g. 0.3 means: 0.3% fee based on input amount)
|
|
46
|
+
* @property {boolean} disableEstimate - check pre-requests of a swap before creating tx (e.g. check having enough balance)
|
|
47
|
+
* @property {string} slippage - User slippage for this swap (e.g. 5.0 which means 5% slippage)
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
export declare type SwapRequest = {
|
|
51
|
+
from: Asset;
|
|
52
|
+
to: Asset;
|
|
53
|
+
amount: string;
|
|
54
|
+
swappers?: string[];
|
|
55
|
+
fromAddress: string;
|
|
56
|
+
toAddress: string;
|
|
57
|
+
referrerAddress: string | null;
|
|
58
|
+
referrerFee: string | null;
|
|
59
|
+
disableEstimate: boolean;
|
|
60
|
+
slippage: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Data of the event including its type and an extra metadata
|
|
64
|
+
* It should be used when an error happened in client and we want to inform server that transaction failed,
|
|
65
|
+
* E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.
|
|
66
|
+
*
|
|
67
|
+
* @property {string} requestId - The requestId from best route endpoint
|
|
68
|
+
* @property {string} eventType - Type of the event that happened, example: TX_FAIL
|
|
69
|
+
* @property {[key: string]: string} data - A list of key-value for extra details
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
export declare type ReportTransactionRequest = {
|
|
73
|
+
requestId: string;
|
|
74
|
+
eventType: 'TX_FAIL';
|
|
75
|
+
data: {
|
|
76
|
+
[key: string]: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The status of transaction in tracking
|
|
81
|
+
*/
|
|
82
|
+
export declare enum TransactionStatus {
|
|
83
|
+
FAILED = "failed",
|
|
84
|
+
RUNNING = "running",
|
|
85
|
+
SUCCESS = "success"
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The final received asset and amount for a swap
|
|
89
|
+
*
|
|
90
|
+
* @property {string} amount - received token amount
|
|
91
|
+
* @property {Token} receivedToken - received token asset
|
|
92
|
+
* @property {string} type - type of received token
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
export declare type StatusOutput = {
|
|
96
|
+
amount: string;
|
|
97
|
+
receivedToken: Token;
|
|
98
|
+
type: "REVERTED_TO_INPUT" | "MIDDLE_ASSET_IN_SRC" | "MIDDLE_ASSET_IN_DEST" | "DESIRED_OUTPUT";
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Response of check transaction status containing the latest status of transaction in blockchain
|
|
102
|
+
*
|
|
103
|
+
* @property {TransactionStatus | null} status - Status of the transaction, while the status is running or null, the
|
|
104
|
+
* client should retry until it turns into success or failed
|
|
105
|
+
* @property {string | null} error - A message in case of failure, that could be shown to the user
|
|
106
|
+
* @property {StatusOutput | null} output - The output asset and amount, it could be different from destination asset in
|
|
107
|
+
* case of failures and refund
|
|
108
|
+
* @property {SwapExplorerUrl[] | null} explorerUrl - List of explorer URLs for the transactions of this swap.
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
export declare type StatusResponse = {
|
|
112
|
+
status: TransactionStatus | null;
|
|
113
|
+
error: string | null;
|
|
114
|
+
output: StatusOutput | null;
|
|
115
|
+
explorerUrl: SwapExplorerUrl[] | null;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Response body of check-approval
|
|
119
|
+
*
|
|
120
|
+
* @property {boolean} isApproved - A flag which indicates that the approve tx is done or not
|
|
121
|
+
*
|
|
122
|
+
*/
|
|
123
|
+
export declare type CheckApprovalResponse = {
|
|
124
|
+
isApproved: boolean;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Response body of swap API
|
|
128
|
+
* @see https://docs.rango.exchange/integration/rango-sdk/sample-transactions
|
|
129
|
+
*
|
|
130
|
+
* @property {string} requestId - The unique requestId which is generated for this request by the server. It should be
|
|
131
|
+
* passed down to all other endpoints if this swap continues on. e.g. d10657ce-b13a-405c-825b-b47f8a5016ad
|
|
132
|
+
* @property {string} resultType - Type of result (OK or error type)
|
|
133
|
+
* @property {QuoteSimulationResult | null} route - Suggested route
|
|
134
|
+
* @property {string | null} error - Error message
|
|
135
|
+
* @property {EvmTransaction | CosmosTransaction | Transfer | null} transaction - Transaction data
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
export declare type SwapResponse = {
|
|
139
|
+
requestId: string;
|
|
140
|
+
resultType: "OK" | "HIGH_IMPACT" | "INPUT_LIMIT_ISSUE" | "NO_ROUTE";
|
|
141
|
+
route: QuoteSimulationResult | null;
|
|
142
|
+
error: string | null;
|
|
143
|
+
tx: EvmTransaction | CosmosTransaction | Transfer | null;
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=transactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../../src/types/api/transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,qBAAqB,EAAC,MAAM,UAAU,CAAC;AACtD,OAAO,EAAC,KAAK,EAAC,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAGlE;;GAEG;AACH,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;;;;;;GAOG;AACH,oBAAY,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED;;;;;;GAMG;AACH,oBAAY,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,oBAAY,WAAW,GAAG;IACxB,IAAI,EAAE,KAAK,CAAA;IACX,EAAE,EAAE,KAAK,CAAA;IACT,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,eAAe,EAAE,OAAO,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;GASG;AACH,oBAAY,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAChC,CAAA;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED;;;;;;;GAOG;AACH,oBAAY,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,KAAK,CAAA;IACpB,IAAI,EAAE,mBAAmB,GAAG,qBAAqB,GAAG,sBAAsB,GAAG,gBAAgB,CAAA;CAC9F,CAAA;AAED;;;;;;;;;;GAUG;AACH,oBAAY,cAAc,GAAG;IAC3B,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,eAAe,EAAE,GAAG,IAAI,CAAA;CACtC,CAAA;AAED;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG;IAClC,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,oBAAY,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,IAAI,GAAG,aAAa,GAAG,mBAAmB,GAAG,UAAU,CAAA;IACnE,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAA;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,EAAE,EAAE,cAAc,GAAG,iBAAiB,GAAG,QAAQ,GAAG,IAAI,CAAA;CACzD,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionStatus = exports.TransactionType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The type of transaction
|
|
6
|
+
*/
|
|
7
|
+
var TransactionType;
|
|
8
|
+
(function (TransactionType) {
|
|
9
|
+
TransactionType["EVM"] = "EVM";
|
|
10
|
+
TransactionType["TRANSFER"] = "TRANSFER";
|
|
11
|
+
TransactionType["COSMOS"] = "COSMOS";
|
|
12
|
+
})(TransactionType = exports.TransactionType || (exports.TransactionType = {}));
|
|
13
|
+
/**
|
|
14
|
+
* The status of transaction in tracking
|
|
15
|
+
*/
|
|
16
|
+
var TransactionStatus;
|
|
17
|
+
(function (TransactionStatus) {
|
|
18
|
+
TransactionStatus["FAILED"] = "failed";
|
|
19
|
+
TransactionStatus["RUNNING"] = "running";
|
|
20
|
+
TransactionStatus["SUCCESS"] = "success";
|
|
21
|
+
})(TransactionStatus = exports.TransactionStatus || (exports.TransactionStatus = {}));
|
|
22
|
+
//# sourceMappingURL=transactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../../src/types/api/transactions.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,wCAAqB,CAAA;IACrB,oCAAiB,CAAA;AACnB,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAuED;;GAEG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;AACrB,CAAC,EAJW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAI5B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AssetWithTicker } from '../common';
|
|
2
|
+
import { TransactionType } 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 {TransactionType} type - This fields equals to TransactionType.COSMOS for all CosmosTransactions
|
|
55
|
+
* @property {string} blockChain - The blockchain that this transaction will be executed in, same as the input blockchain of creating transaction
|
|
56
|
+
* @property {string} fromWalletAddress - Address of wallet that this transaction should be executed in, same as the create transaction request's input
|
|
57
|
+
* @property {CosmosMessage} data - Transaction data
|
|
58
|
+
* @property {CosmosRawTransferData} rawTransfer - An alternative to CosmosMessage object for the cosmos wallets that do not support generic Cosmos messages
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
export interface CosmosTransaction {
|
|
62
|
+
type: TransactionType;
|
|
63
|
+
blockChain: string;
|
|
64
|
+
fromWalletAddress: string;
|
|
65
|
+
data: CosmosMessage;
|
|
66
|
+
rawTransfer: CosmosRawTransferData;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=cosmos.d.ts.map
|
|
@@ -0,0 +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,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAA;AAE/C;;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;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB,EAAE,MAAM,CAAA;IACzB,IAAI,EAAE,aAAa,CAAA;IACnB,WAAW,EAAE,qBAAqB,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../../../../src/types/api/txs/cosmos.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TransactionType } from "../transactions";
|
|
2
|
+
/**
|
|
3
|
+
* The transaction object for all EVM-based blockchains, including Ethereum, BSC, Polygon, Harmony, etc
|
|
4
|
+
*
|
|
5
|
+
* @property {TransactionType} type - This fields equals to TransactionType.EVM for all EVMTransactions
|
|
6
|
+
* @property {string} blockChain - The blockchain that this transaction is going to run in
|
|
7
|
+
* @property {string | null} from - The source wallet address, it can be null
|
|
8
|
+
* @property {string} approveTo - Address of source token erc20 contract for increasing approve amount
|
|
9
|
+
* @property {string | null} approveData - The data of approve transaction
|
|
10
|
+
* @property {string} txTo - Address of dex/bridge smart contract that is going to be called
|
|
11
|
+
* @property {string | null} txData - The data of main transaction, 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} gasPrice - The suggested gas price for this transaction
|
|
14
|
+
* @property {string | null} gasLimit - The suggested gas limit for this transaction
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export interface EvmTransaction {
|
|
18
|
+
type: TransactionType;
|
|
19
|
+
blockChain: string;
|
|
20
|
+
from: string | null;
|
|
21
|
+
approveTo: string | null;
|
|
22
|
+
approveData: string | null;
|
|
23
|
+
txTo: string;
|
|
24
|
+
txData: string | null;
|
|
25
|
+
value: string | null;
|
|
26
|
+
gasLimit: string | null;
|
|
27
|
+
gasPrice: string | null;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=evm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evm.d.ts","sourceRoot":"","sources":["../../../../src/types/api/txs/evm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAA;AAG/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,eAAe,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evm.js","sourceRoot":"","sources":["../../../../src/types/api/txs/evm.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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("./evm"), exports);
|
|
18
|
+
__exportStar(require("./cosmos"), exports);
|
|
19
|
+
__exportStar(require("./transfer"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/api/txs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,2CAAwB;AACxB,6CAA0B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AssetWithTicker } from '../common';
|
|
2
|
+
import { TransactionType } 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 {TransactionType} type - This fields equals to TransactionType.TRANSFER for all TransferTransactions
|
|
7
|
+
* @property {string} method - The method that should be passed to wallet. examples: deposit, transfer
|
|
8
|
+
* @property {AssetWithTicker} asset
|
|
9
|
+
* @property {string} amount - The machine-readable amount of transaction, example: 1000000000000000000
|
|
10
|
+
* @property {number} decimals - The decimals of the asset
|
|
11
|
+
* @property {string} fromWalletAddress - The source wallet address that can sign this transaction
|
|
12
|
+
* @property {string} recipientAddress - The destination wallet address that the fund should be sent to
|
|
13
|
+
* @property {string | null} memo - The memo of transaction, can be null
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export interface Transfer {
|
|
17
|
+
type: TransactionType;
|
|
18
|
+
method: string;
|
|
19
|
+
asset: AssetWithTicker;
|
|
20
|
+
amount: string;
|
|
21
|
+
decimals: number;
|
|
22
|
+
fromWalletAddress: string;
|
|
23
|
+
recipientAddress: string;
|
|
24
|
+
memo: string | null;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=transfer.d.ts.map
|
|
@@ -0,0 +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,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,eAAe,CAAA;IACrB,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../../../src/types/api/txs/transfer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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("./api/balance"), exports);
|
|
18
|
+
__exportStar(require("./api/common"), exports);
|
|
19
|
+
__exportStar(require("./api/meta"), exports);
|
|
20
|
+
__exportStar(require("./api/routing"), exports);
|
|
21
|
+
__exportStar(require("./api/transactions"), exports);
|
|
22
|
+
__exportStar(require("./api/txs"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,+CAA4B;AAC5B,6CAA0B;AAC1B,gDAA6B;AAC7B,qDAAkC;AAClC,4CAAyB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rango-sdk-basic",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Rango Exchange Basic SDK for dApps",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rango-exchange/rango-sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/rango-exchange/rango-sdk/tree/basic-api",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/rango-exchange/rango-sdk/issues"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "jest --config jestconfig.json",
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"format": "prettier --write ./src",
|
|
19
|
+
"lint": "eslint */**/*.{js,ts} --quiet --fix",
|
|
20
|
+
"semantic-release": "semantic-release"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"Rango Exchange",
|
|
24
|
+
"SDK",
|
|
25
|
+
"Cross-Chain",
|
|
26
|
+
"Multi-Chain"
|
|
27
|
+
],
|
|
28
|
+
"files": [
|
|
29
|
+
"lib/**/*"
|
|
30
|
+
],
|
|
31
|
+
"author": "rango.exchange",
|
|
32
|
+
"license": "GPL-3.0",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/jest": "^27.4.0",
|
|
35
|
+
"@types/uuid": "^8.3.4",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
|
37
|
+
"@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"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"axios": "^0.24.0",
|
|
50
|
+
"bignumber.js": "^9.0.2",
|
|
51
|
+
"uuid": "^8.3.2"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public",
|
|
55
|
+
"branches": [
|
|
56
|
+
"master"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|