@chainrails/common 0.0.5 → 0.0.7
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.
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(a || {}), i = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(i || {}), r = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(r || {});
|
|
2
2
|
class t {
|
|
3
|
-
constructor({ api_key:
|
|
4
|
-
this.api_key =
|
|
3
|
+
constructor({ api_key: E, env: T }) {
|
|
4
|
+
this.api_key = E, this.env = T ?? r.PRODUCTION;
|
|
5
5
|
}
|
|
6
|
-
static config(
|
|
6
|
+
static config(E) {
|
|
7
7
|
if (!t.app) {
|
|
8
|
-
if (!
|
|
8
|
+
if (!E)
|
|
9
9
|
throw new Error("Please provide an api_key");
|
|
10
|
-
t.app = new t(
|
|
10
|
+
t.app = new t(E);
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return E && (t.app.api_key = E.api_key, E.env !== void 0 && (t.app.env = E.env)), t.app;
|
|
13
13
|
}
|
|
14
14
|
static getApiKey() {
|
|
15
|
+
if (!t.app)
|
|
16
|
+
throw new Error(
|
|
17
|
+
"Chainrails SDK not configured. Please call Chainrails.config() first."
|
|
18
|
+
);
|
|
15
19
|
return t.app.api_key;
|
|
16
20
|
}
|
|
17
21
|
static getEnv() {
|
|
22
|
+
if (!t.app)
|
|
23
|
+
throw new Error(
|
|
24
|
+
"Chainrails SDK not configured. Please call Chainrails.config() first."
|
|
25
|
+
);
|
|
18
26
|
return t.app.env;
|
|
19
27
|
}
|
|
20
28
|
static getBaseUrl() {
|
|
21
|
-
|
|
29
|
+
if (!t.app)
|
|
30
|
+
throw new Error(
|
|
31
|
+
"Chainrails SDK not configured. Please call Chainrails.config() first."
|
|
32
|
+
);
|
|
33
|
+
switch (t.app.env) {
|
|
22
34
|
case "production":
|
|
23
35
|
return "https://api.chainrails.io/api/v1";
|
|
24
36
|
case "staging":
|
|
@@ -32,7 +44,7 @@ class t {
|
|
|
32
44
|
}
|
|
33
45
|
export {
|
|
34
46
|
t as Chainrails,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
a as chains,
|
|
48
|
+
r as environment,
|
|
49
|
+
i as tokens
|
|
38
50
|
};
|
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(a || {}), i = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(i || {}), r = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(r || {});
|
|
2
2
|
class t {
|
|
3
|
-
constructor({ api_key:
|
|
4
|
-
this.api_key =
|
|
3
|
+
constructor({ api_key: E, env: T }) {
|
|
4
|
+
this.api_key = E, this.env = T ?? r.PRODUCTION;
|
|
5
5
|
}
|
|
6
|
-
static config(
|
|
6
|
+
static config(E) {
|
|
7
7
|
if (!t.app) {
|
|
8
|
-
if (!
|
|
8
|
+
if (!E)
|
|
9
9
|
throw new Error("Please provide an api_key");
|
|
10
|
-
t.app = new t(
|
|
10
|
+
t.app = new t(E);
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return E && (t.app.api_key = E.api_key, E.env !== void 0 && (t.app.env = E.env)), t.app;
|
|
13
13
|
}
|
|
14
14
|
static getApiKey() {
|
|
15
|
+
if (!t.app)
|
|
16
|
+
throw new Error(
|
|
17
|
+
"Chainrails SDK not configured. Please call Chainrails.config() first."
|
|
18
|
+
);
|
|
15
19
|
return t.app.api_key;
|
|
16
20
|
}
|
|
17
21
|
static getEnv() {
|
|
22
|
+
if (!t.app)
|
|
23
|
+
throw new Error(
|
|
24
|
+
"Chainrails SDK not configured. Please call Chainrails.config() first."
|
|
25
|
+
);
|
|
18
26
|
return t.app.env;
|
|
19
27
|
}
|
|
20
28
|
static getBaseUrl() {
|
|
21
|
-
|
|
29
|
+
if (!t.app)
|
|
30
|
+
throw new Error(
|
|
31
|
+
"Chainrails SDK not configured. Please call Chainrails.config() first."
|
|
32
|
+
);
|
|
33
|
+
switch (t.app.env) {
|
|
22
34
|
case "production":
|
|
23
35
|
return "https://api.chainrails.io/api/v1";
|
|
24
36
|
case "staging":
|
|
@@ -32,7 +44,7 @@ class t {
|
|
|
32
44
|
}
|
|
33
45
|
export {
|
|
34
46
|
t as Chainrails,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
a as chains,
|
|
48
|
+
r as environment,
|
|
49
|
+
i as tokens
|
|
38
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(i,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(i=typeof globalThis<"u"?globalThis:i||self,E(i.Chainrails={}))})(this,(function(i){"use strict";var E=(e=>(e.ARBITRUM="ARBITRUM_MAINNET",e.ARBITRUM_TESTNET="ARBITRUM_TESTNET",e.AVALANCHE="AVALANCHE_MAINNET",e.AVALANCHE_TESTNET="AVALANCHE_TESTNET",e.BASE="BASE_MAINNET",e.BASE_TESTNET="BASE_TESTNET",e.BSC="BSC_MAINNET",e.ETHEREUM="ETHEREUM_MAINNET",e.ETHEREUM_TESTNET="ETHEREUM_TESTNET",e.STARKNET="STARKNET_MAINNET",e))(E||{}),T=(e=>(e.USDC="USDC",e))(T||{}),r=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(r||{});class t{constructor({api_key:n,env:a}){this.api_key=n,this.env=a??r.PRODUCTION}static config(n){if(!t.app){if(!n)throw new Error("Please provide an api_key");t.app=new t(n)}return n&&(t.app.api_key=n.api_key,n.env!==void 0&&(t.app.env=n.env)),t.app}static getApiKey(){if(!t.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return t.app.api_key}static getEnv(){if(!t.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return t.app.env}static getBaseUrl(){if(!t.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(t.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"todo";default:return"https://api.chainrails.io/api/v1"}}}i.Chainrails=t,i.chains=E,i.environment=r,i.tokens=T,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtD,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAa;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IAEb,OAAO;WAKO,MAAM,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,UAAU;WAiB5C,SAAS,IAAI,MAAM;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtD,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAa;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IAEb,OAAO;WAKO,MAAM,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,UAAU;WAiB5C,SAAS,IAAI,MAAM;WASnB,MAAM,IAAI,OAAO;WASjB,UAAU,IAAI,MAAM;CAiBnC"}
|