@chainrails/sdk 0.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.
- package/dist/chainrails-sdk.es.js +89 -0
- package/dist/chainrails-sdk.es.mjs +89 -0
- package/dist/chainrails-sdk.umd.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/src/Client/index.d.ts +6 -0
- package/dist/src/Client/index.d.ts.map +1 -0
- package/dist/src/Client/types.d.ts +8 -0
- package/dist/src/Client/types.d.ts.map +1 -0
- package/dist/src/Intents/index.d.ts +13 -0
- package/dist/src/Intents/index.d.ts.map +1 -0
- package/dist/src/Intents/types.d.ts +73 -0
- package/dist/src/Intents/types.d.ts.map +1 -0
- package/dist/src/Quotes/index.d.ts +6 -0
- package/dist/src/Quotes/index.d.ts.map +1 -0
- package/dist/src/Quotes/types.d.ts +31 -0
- package/dist/src/Quotes/types.d.ts.map +1 -0
- package/dist/src/Router/index.d.ts +9 -0
- package/dist/src/Router/index.d.ts.map +1 -0
- package/dist/src/Router/types.d.ts +49 -0
- package/dist/src/Router/types.d.ts.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/req.d.ts +8 -0
- package/dist/src/req.d.ts.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import n from "ky";
|
|
2
|
+
class r {
|
|
3
|
+
constructor({ api_key: e }) {
|
|
4
|
+
this.api_key = e;
|
|
5
|
+
}
|
|
6
|
+
static config(e) {
|
|
7
|
+
if (!r.app) {
|
|
8
|
+
if (!e)
|
|
9
|
+
throw new Error("Please provide an api_key");
|
|
10
|
+
r.app = new r(e);
|
|
11
|
+
}
|
|
12
|
+
return e && (this.app.api_key = e.api_key), r.app;
|
|
13
|
+
}
|
|
14
|
+
static getApiKey() {
|
|
15
|
+
return r.app.api_key;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const t = n.create({
|
|
19
|
+
prefixUrl: "https://dev.chainrails.io/api/v1",
|
|
20
|
+
headers: {
|
|
21
|
+
"Content-Type": "application/json"
|
|
22
|
+
},
|
|
23
|
+
hooks: {
|
|
24
|
+
beforeRequest: [
|
|
25
|
+
(s) => {
|
|
26
|
+
const e = r.getApiKey();
|
|
27
|
+
s.headers.set("Authorization", `Bearer ${e}`);
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
afterResponse: [(s, e, a) => a]
|
|
31
|
+
},
|
|
32
|
+
retry: {
|
|
33
|
+
limit: 2
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
class i {
|
|
37
|
+
async getClientInfo() {
|
|
38
|
+
return await t.get("client/auth/client-info").json();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class o {
|
|
42
|
+
async getById(e) {
|
|
43
|
+
return await t.get("intents/" + e).json();
|
|
44
|
+
}
|
|
45
|
+
async getForSender(e) {
|
|
46
|
+
return await t.get("intents/user/" + e).json();
|
|
47
|
+
}
|
|
48
|
+
async getForAddress(e) {
|
|
49
|
+
return await t.get("intents/address/" + e).json();
|
|
50
|
+
}
|
|
51
|
+
async getAll(e) {
|
|
52
|
+
return await t.get("intents", { searchParams: e }).json();
|
|
53
|
+
}
|
|
54
|
+
async create(e) {
|
|
55
|
+
return await t.post("intents", { json: e }).json();
|
|
56
|
+
}
|
|
57
|
+
async update(e, a) {
|
|
58
|
+
return await t.post("intents", { json: a }).json();
|
|
59
|
+
}
|
|
60
|
+
//Calculate Destination
|
|
61
|
+
}
|
|
62
|
+
class p {
|
|
63
|
+
async getAll(e) {
|
|
64
|
+
return await t.get("quotes/multi-source", { searchParams: e }).json();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class u {
|
|
68
|
+
async getOptimalRoutes(e) {
|
|
69
|
+
return await t.get("router/optimal-route", { searchParams: e }).json();
|
|
70
|
+
}
|
|
71
|
+
async getAllSupportedBridges() {
|
|
72
|
+
return await t.get("router/supported-bridges/all").json();
|
|
73
|
+
}
|
|
74
|
+
async getSupportedBridges(e) {
|
|
75
|
+
return await t.get("router/supported-bridges/route", { searchParams: e }).json();
|
|
76
|
+
}
|
|
77
|
+
async getSupportedRoutes(e, a) {
|
|
78
|
+
return await t.get("router/supported-bridges/bridge/" + e, { searchParams: a }).json();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const g = {
|
|
82
|
+
router: new u(),
|
|
83
|
+
quotes: new p(),
|
|
84
|
+
intents: new o(),
|
|
85
|
+
client: new i()
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
g as CRAPI
|
|
89
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import n from "ky";
|
|
2
|
+
class r {
|
|
3
|
+
constructor({ api_key: e }) {
|
|
4
|
+
this.api_key = e;
|
|
5
|
+
}
|
|
6
|
+
static config(e) {
|
|
7
|
+
if (!r.app) {
|
|
8
|
+
if (!e)
|
|
9
|
+
throw new Error("Please provide an api_key");
|
|
10
|
+
r.app = new r(e);
|
|
11
|
+
}
|
|
12
|
+
return e && (this.app.api_key = e.api_key), r.app;
|
|
13
|
+
}
|
|
14
|
+
static getApiKey() {
|
|
15
|
+
return r.app.api_key;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const t = n.create({
|
|
19
|
+
prefixUrl: "https://dev.chainrails.io/api/v1",
|
|
20
|
+
headers: {
|
|
21
|
+
"Content-Type": "application/json"
|
|
22
|
+
},
|
|
23
|
+
hooks: {
|
|
24
|
+
beforeRequest: [
|
|
25
|
+
(s) => {
|
|
26
|
+
const e = r.getApiKey();
|
|
27
|
+
s.headers.set("Authorization", `Bearer ${e}`);
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
afterResponse: [(s, e, a) => a]
|
|
31
|
+
},
|
|
32
|
+
retry: {
|
|
33
|
+
limit: 2
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
class i {
|
|
37
|
+
async getClientInfo() {
|
|
38
|
+
return await t.get("client/auth/client-info").json();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class o {
|
|
42
|
+
async getById(e) {
|
|
43
|
+
return await t.get("intents/" + e).json();
|
|
44
|
+
}
|
|
45
|
+
async getForSender(e) {
|
|
46
|
+
return await t.get("intents/user/" + e).json();
|
|
47
|
+
}
|
|
48
|
+
async getForAddress(e) {
|
|
49
|
+
return await t.get("intents/address/" + e).json();
|
|
50
|
+
}
|
|
51
|
+
async getAll(e) {
|
|
52
|
+
return await t.get("intents", { searchParams: e }).json();
|
|
53
|
+
}
|
|
54
|
+
async create(e) {
|
|
55
|
+
return await t.post("intents", { json: e }).json();
|
|
56
|
+
}
|
|
57
|
+
async update(e, a) {
|
|
58
|
+
return await t.post("intents", { json: a }).json();
|
|
59
|
+
}
|
|
60
|
+
//Calculate Destination
|
|
61
|
+
}
|
|
62
|
+
class p {
|
|
63
|
+
async getAll(e) {
|
|
64
|
+
return await t.get("quotes/multi-source", { searchParams: e }).json();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class u {
|
|
68
|
+
async getOptimalRoutes(e) {
|
|
69
|
+
return await t.get("router/optimal-route", { searchParams: e }).json();
|
|
70
|
+
}
|
|
71
|
+
async getAllSupportedBridges() {
|
|
72
|
+
return await t.get("router/supported-bridges/all").json();
|
|
73
|
+
}
|
|
74
|
+
async getSupportedBridges(e) {
|
|
75
|
+
return await t.get("router/supported-bridges/route", { searchParams: e }).json();
|
|
76
|
+
}
|
|
77
|
+
async getSupportedRoutes(e, a) {
|
|
78
|
+
return await t.get("router/supported-bridges/bridge/" + e, { searchParams: a }).json();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const g = {
|
|
82
|
+
router: new u(),
|
|
83
|
+
quotes: new p(),
|
|
84
|
+
intents: new o(),
|
|
85
|
+
client: new i()
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
g as CRAPI
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(s,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("ky")):typeof define=="function"&&define.amd?define(["exports","ky"],a):(s=typeof globalThis<"u"?globalThis:s||self,a(s.Chainrails={},s.Ky))})(this,(function(s,a){"use strict";class r{constructor({api_key:e}){this.api_key=e}static config(e){if(!r.app){if(!e)throw new Error("Please provide an api_key");r.app=new r(e)}return e&&(this.app.api_key=e.api_key),r.app}static getApiKey(){return r.app.api_key}}const t=a.create({prefixUrl:"https://dev.chainrails.io/api/v1",headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[n=>{const e=r.getApiKey();n.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(n,e,i)=>i]},retry:{limit:2}});class o{async getClientInfo(){return await t.get("client/auth/client-info").json()}}class p{async getById(e){return await t.get("intents/"+e).json()}async getForSender(e){return await t.get("intents/user/"+e).json()}async getForAddress(e){return await t.get("intents/address/"+e).json()}async getAll(e){return await t.get("intents",{searchParams:e}).json()}async create(e){return await t.post("intents",{json:e}).json()}async update(e,i){return await t.post("intents",{json:i}).json()}}class u{async getAll(e){return await t.get("quotes/multi-source",{searchParams:e}).json()}}class c{async getOptimalRoutes(e){return await t.get("router/optimal-route",{searchParams:e}).json()}async getAllSupportedBridges(){return await t.get("router/supported-bridges/all").json()}async getSupportedBridges(e){return await t.get("router/supported-bridges/route",{searchParams:e}).json()}async getSupportedRoutes(e,i){return await t.get("router/supported-bridges/bridge/"+e,{searchParams:i}).json()}}const d={router:new c,quotes:new u,intents:new p,client:new o};s.CRAPI=d,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAA;AAE/B,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Client/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAE7C,MAAM,CAAC,OAAO,OAAO,MAAM;IACnB,aAAa;CAGpB;AAED,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Client/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createIntentInput, getAllIntentsInput, getAllIntentsOutput, Intent, Status } from "./types";
|
|
2
|
+
export default class Intents {
|
|
3
|
+
getById(id: string): Promise<Intent>;
|
|
4
|
+
getForSender(sender: `0x${string}`): Promise<Intent[]>;
|
|
5
|
+
getForAddress(address: `0x${string}`): Promise<Intent>;
|
|
6
|
+
getAll(searchParams: getAllIntentsInput): Promise<getAllIntentsOutput>;
|
|
7
|
+
create(json: createIntentInput): Promise<Intent>;
|
|
8
|
+
update(id: string, json: {
|
|
9
|
+
status: Status;
|
|
10
|
+
}): Promise<Intent>;
|
|
11
|
+
}
|
|
12
|
+
export * from "./types";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Intents/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEpG,MAAM,CAAC,OAAO,OAAO,OAAO;IACpB,OAAO,CAAC,EAAE,EAAE,MAAM;IAGlB,YAAY,CAAC,MAAM,EAAE,KAAK,MAAM,EAAE;IAGlC,aAAa,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE;IAGpC,MAAM,CAAC,YAAY,EAAE,kBAAkB;IAGvC,MAAM,CAAC,IAAI,EAAE,iBAAiB;IAG9B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;CAIlD;AAED,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type Status = "PENDING" | "FUNDED" | "INITIATED" | "COMPLETED" | "EXPIRED";
|
|
2
|
+
export interface Quote {
|
|
3
|
+
sourceChain: string;
|
|
4
|
+
destinationChain: string;
|
|
5
|
+
bestQuote: {
|
|
6
|
+
bridgeFeeDetails: {
|
|
7
|
+
maxFee: string;
|
|
8
|
+
};
|
|
9
|
+
totalFee: string;
|
|
10
|
+
totalFeeFormatted: string;
|
|
11
|
+
route: {
|
|
12
|
+
tokenIn: `0x${string}`;
|
|
13
|
+
tokenOut: `0x${string}`;
|
|
14
|
+
sourceChain: string;
|
|
15
|
+
destinationChain: string;
|
|
16
|
+
amount: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface Intent {
|
|
21
|
+
id: number;
|
|
22
|
+
sender: `0x${string}`;
|
|
23
|
+
initialAmount: number;
|
|
24
|
+
fees: number;
|
|
25
|
+
totalAmount: number;
|
|
26
|
+
tokenIn: `0x${string}`;
|
|
27
|
+
tokenOut: `0x${string}`;
|
|
28
|
+
intent_address: `0x${string}`;
|
|
29
|
+
source_chain: string;
|
|
30
|
+
destination_chain: string;
|
|
31
|
+
recipient: `0x${string}`;
|
|
32
|
+
refund_address: `0x${string}`;
|
|
33
|
+
relayer: string;
|
|
34
|
+
coordinator: `0x${string}`;
|
|
35
|
+
bridger: `0x${string}`;
|
|
36
|
+
bridgeExtraData: `0x${string}`;
|
|
37
|
+
intent_nonce: number;
|
|
38
|
+
intent_status: "DECLARED" | Status;
|
|
39
|
+
tx_hash: string;
|
|
40
|
+
needs_relay: true;
|
|
41
|
+
expires_at: string;
|
|
42
|
+
metadata: {
|
|
43
|
+
description: string;
|
|
44
|
+
reference: string;
|
|
45
|
+
};
|
|
46
|
+
created_at: string;
|
|
47
|
+
updated_at: string;
|
|
48
|
+
}
|
|
49
|
+
export type getAllIntentsInput = {
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
status?: "pending" | "processing" | "completed" | "failed";
|
|
53
|
+
};
|
|
54
|
+
export interface getAllIntentsOutput {
|
|
55
|
+
intents: Intent[];
|
|
56
|
+
total: `${number}`;
|
|
57
|
+
limit: number;
|
|
58
|
+
offset: number;
|
|
59
|
+
}
|
|
60
|
+
export interface createIntentInput {
|
|
61
|
+
sender: `0x${string}`;
|
|
62
|
+
amount: number;
|
|
63
|
+
tokenIn: `0x${string}`;
|
|
64
|
+
source_chain: string;
|
|
65
|
+
destination_chain: string;
|
|
66
|
+
recipient: `0x${string}`;
|
|
67
|
+
refund_address: `0x${string}`;
|
|
68
|
+
metadata: {
|
|
69
|
+
description: string;
|
|
70
|
+
reference: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Intents/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,CAAA;AAEjF,MAAM,WAAW,KAAK;IAEpB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE;QACT,gBAAgB,EAAE;YAChB,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,QAAQ,EAAE,MAAM,CAAA;QAChB,iBAAiB,EAAE,MAAM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IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAA;CAC3D,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,EAAE,GAAG,MAAM,EAAE,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,KAAK,MAAM,EAAE,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAA;IACxB,cAAc,EAAE,KAAK,MAAM,EAAE,CAAA;IAC7B,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAA;QACnB,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Quotes/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEnD,MAAM,CAAC,OAAO,OAAO,MAAM;IACnB,MAAM,CAAC,KAAK,EAAE,WAAW;CAGhC;AAED,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface Quote {
|
|
2
|
+
sourceChain: string;
|
|
3
|
+
destinationChain: string;
|
|
4
|
+
bestQuote: {
|
|
5
|
+
bridgeFeeDetails: {
|
|
6
|
+
maxFee: string;
|
|
7
|
+
};
|
|
8
|
+
totalFee: string;
|
|
9
|
+
totalFeeFormatted: string;
|
|
10
|
+
route: {
|
|
11
|
+
tokenIn: `0x${string}`;
|
|
12
|
+
tokenOut: `0x${string}`;
|
|
13
|
+
sourceChain: string;
|
|
14
|
+
destinationChain: string;
|
|
15
|
+
amount: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface getAllInput {
|
|
20
|
+
destinationChain: string;
|
|
21
|
+
tokenOut: `0x${string}`;
|
|
22
|
+
amount: string;
|
|
23
|
+
recipient: `0x${string}`;
|
|
24
|
+
[key: string]: string | number | boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface getAllOutput {
|
|
27
|
+
destinationChain: string;
|
|
28
|
+
quotes: Quote[];
|
|
29
|
+
cheapestOption: Quote;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Quotes/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IAEpB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE;QACT,gBAAgB,EAAE;YAChB,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,QAAQ,EAAE,MAAM,CAAA;QAChB,iBAAiB,EAAE,MAAM,CAAA;QACzB,KAAK,EAAE;YACL,OAAO,EAAE,KAAK,MAAM,EAAE,CAAA;YACtB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAA;YACvB,WAAW,EAAE,MAAM,CAAA;YACnB,gBAAgB,EAAE,MAAM,CAAA;YACxB,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;KACF,CAAA;CACF;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,KAAK,MAAM,EAAE,CAAA;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CACrD;AAED,MAAM,WAAW,YAAY;IAC3B,gBAAgB,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,cAAc,EAAE,KAAK,CAAA;CACtB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Bridge, getAllSupportedBridgesOutput, getOptimalRoutesInput, getOptimalRoutesOutput, getSupportedBridgesInput, getSupportedBridgesOutput } from "./types";
|
|
2
|
+
export default class Router {
|
|
3
|
+
getOptimalRoutes(input: getOptimalRoutesInput): Promise<getOptimalRoutesOutput>;
|
|
4
|
+
getAllSupportedBridges(): Promise<getAllSupportedBridgesOutput>;
|
|
5
|
+
getSupportedBridges(input: getSupportedBridgesInput): Promise<getSupportedBridgesOutput>;
|
|
6
|
+
getSupportedRoutes(bridge: Bridge, input: getSupportedBridgesInput): Promise<getOptimalRoutesInput[]>;
|
|
7
|
+
}
|
|
8
|
+
export * from "./types";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Router/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,4BAA4B,EAC5B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAEhB,MAAM,CAAC,OAAO,OAAO,MAAM;IACnB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB;IAI7C,sBAAsB;IAItB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB;IAInD,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB;CAGzE;AAED,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type Bridge = "ACROSS" | "CCTP" | "GATEWAY" | "RHINOFI";
|
|
2
|
+
export interface getOptimalRoutesInput {
|
|
3
|
+
sourceChain: number;
|
|
4
|
+
destinationChain: number;
|
|
5
|
+
tokenIn: `0x${string}`;
|
|
6
|
+
tokenOut: `0x${string}`;
|
|
7
|
+
amount: string;
|
|
8
|
+
[key: string]: string | number | boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface getOptimalRoutesOutput {
|
|
11
|
+
sourceChain: string;
|
|
12
|
+
destinationChain: string;
|
|
13
|
+
tokenIn: `0x${string}`;
|
|
14
|
+
tokenOut: `0x${string}`;
|
|
15
|
+
originalAmount: string;
|
|
16
|
+
totalFees: string;
|
|
17
|
+
bridgeToUse: Bridge;
|
|
18
|
+
bridgeAddress: `0x${string}`;
|
|
19
|
+
bridgeExtraData: `0x${string}`;
|
|
20
|
+
supportedBridges: Bridge[];
|
|
21
|
+
}
|
|
22
|
+
export interface getAllSupportedBridgesOutput {
|
|
23
|
+
bridges: {
|
|
24
|
+
[key in Bridge]: [{
|
|
25
|
+
sourceChain: number;
|
|
26
|
+
destinationChain: number;
|
|
27
|
+
}[]];
|
|
28
|
+
};
|
|
29
|
+
metadata: {
|
|
30
|
+
totalBridges: number;
|
|
31
|
+
totalRoutes: number;
|
|
32
|
+
lastUpdated: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface getSupportedBridgesInput {
|
|
36
|
+
sourceChain: number;
|
|
37
|
+
destinationChain: number;
|
|
38
|
+
[key: string]: string | number | boolean | undefined;
|
|
39
|
+
}
|
|
40
|
+
export interface getSupportedBridgesOutput {
|
|
41
|
+
supportedBridges: Bridge[];
|
|
42
|
+
routeInfo: {
|
|
43
|
+
sourceChain: number;
|
|
44
|
+
destinationChain: number;
|
|
45
|
+
bridgeCount: number;
|
|
46
|
+
isSupported: true;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Router/types.ts"],"names":[],"mappings":"AAAA,MAAM,M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AED,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,SAAS,EAAE;QACT,WAAW,EAAE,MAAM,CAAA;QACnB,gBAAgB,EAAE,MAAM,CAAA;QACxB,WAAW,EAAE,MAAM,CAAA;QACnB,WAAW,EAAE,IAAI,CAAA;KAClB,CAAA;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Client from "./Client";
|
|
2
|
+
import Intents from "./Intents";
|
|
3
|
+
import Quotes from "./Quotes";
|
|
4
|
+
import Router from "./Router";
|
|
5
|
+
declare const cr: {
|
|
6
|
+
router: Router;
|
|
7
|
+
quotes: Quotes;
|
|
8
|
+
intents: Intents;
|
|
9
|
+
client: Client;
|
|
10
|
+
};
|
|
11
|
+
export default cr;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,QAAA,MAAM,EAAE;;;;;CAKP,CAAA;AAED,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"req.d.ts","sourceRoot":"","sources":["../../src/req.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,cAAc,EAAE,OAAO,CAAA;KACxB;CACF;AAED,QAAA,MAAM,GAAG,yBAiBP,CAAA;AAEF,eAAe,GAAG,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chainrails/sdk",
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"main": "./dist/chainrails-sdk.umd.js",
|
|
6
|
+
"module": "./dist/chainrails-sdk.es.mjs",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/horuslabsio/chainrails-sdk",
|
|
11
|
+
"directory": "react"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"check-types": "tsc --noEmit",
|
|
15
|
+
"lint": "eslint \"**/*.ts\"",
|
|
16
|
+
"build": "rm -rf dist && vite build && cp ./dist/chainrails-sdk.es.js ./dist/chainrails-sdk.es.mjs && tsc --emitDeclarationOnly --declarationDir dist",
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"prepare": "pnpm run clean && pnpm run build"
|
|
19
|
+
},
|
|
20
|
+
"source": "./index.ts",
|
|
21
|
+
"types": "./dist/src/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/src/index.d.ts",
|
|
28
|
+
"import": "./dist/chainrails-sdk.es.mjs",
|
|
29
|
+
"require": "./dist/chainrails-sdk.umd.js"
|
|
30
|
+
},
|
|
31
|
+
"./src": {
|
|
32
|
+
"types": "./src/index.ts",
|
|
33
|
+
"import": "./src/index.ts",
|
|
34
|
+
"require": "./src/index.ts"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@chainrails/common": "workspace:*",
|
|
39
|
+
"ky": "^1.14.0",
|
|
40
|
+
"vite": "^7.1.9"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"eslint": "^8.57.0",
|
|
44
|
+
"typescript": "5.5.4"
|
|
45
|
+
}
|
|
46
|
+
}
|