@gardenfi/orderbook 3.1.3-beta.18 → 3.1.3-beta.19

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/index8.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index4.cjs");class o{constructor(t,r){this.chain=t,this.symbol=r,this.blockchainType=e.getBlockchainType(t),this.formatted=`${t.toLowerCase()}:${r.toLowerCase()}`,this.network=e.Config[t].network,this.asset=e.Assets[t][r]}static from(t){return t instanceof o?t:typeof t=="string"?o.fromString(t):o.fromAsset(t)}static fromChainAndSymbol(t,r){return new o(t,r)}static fromString(t){const[r,n]=t.split(":");if(!(r in e.Chains))throw new Error(`Invalid chain in asset string: ${r}`);return new o(r,n)}static fromAsset(t){return new o(t.chain,t.symbol)}toString(){return this.formatted}toJSON(){return this.formatted}}exports.ChainAsset=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index4.cjs");class o{constructor(t,r){this.chain=t,this.symbol=r,this.blockchainType=i.getBlockchainType(t),this.formatted=`${t.toLowerCase()}:${r.toLowerCase()}`,this.network=i.Config[t].network,this.asset=i.Assets[t][r]}static from(t){return t instanceof o?t:typeof t=="string"?o.fromString(t):o.fromAsset(t)}static fromChainAndSymbol(t,r){return new o(t,r)}static fromString(t){const[r,n]=t.split(":");if(!(r in i.Chains))throw new Error(`Invalid chain in asset string: ${r}`);return new o(r,n)}static fromAsset(t){return t.id?o.from(t.id):new o(t.chain,t.symbol)}toString(){return this.formatted}toJSON(){return this.formatted}}exports.ChainAsset=o;
package/dist/index8.js CHANGED
@@ -1,23 +1,23 @@
1
- import { getBlockchainType as i, Config as e, Assets as f, Chains as s } from "./index4.js";
1
+ import { getBlockchainType as n, Config as e, Assets as f, Chains as m } from "./index4.js";
2
2
  class o {
3
- constructor(t, r) {
4
- this.chain = t, this.symbol = r, this.blockchainType = i(t), this.formatted = `${t.toLowerCase()}:${r.toLowerCase()}`, this.network = e[t].network, this.asset = f[t][r];
3
+ constructor(r, t) {
4
+ this.chain = r, this.symbol = t, this.blockchainType = n(r), this.formatted = `${r.toLowerCase()}:${t.toLowerCase()}`, this.network = e[r].network, this.asset = f[r][t];
5
5
  }
6
6
  /* ---------------- factories ---------------- */
7
- static from(t) {
8
- return t instanceof o ? t : typeof t == "string" ? o.fromString(t) : o.fromAsset(t);
7
+ static from(r) {
8
+ return r instanceof o ? r : typeof r == "string" ? o.fromString(r) : o.fromAsset(r);
9
9
  }
10
- static fromChainAndSymbol(t, r) {
11
- return new o(t, r);
10
+ static fromChainAndSymbol(r, t) {
11
+ return new o(r, t);
12
12
  }
13
- static fromString(t) {
14
- const [r, n] = t.split(":");
15
- if (!(r in s))
16
- throw new Error(`Invalid chain in asset string: ${r}`);
17
- return new o(r, n);
13
+ static fromString(r) {
14
+ const [t, i] = r.split(":");
15
+ if (!(t in m))
16
+ throw new Error(`Invalid chain in asset string: ${t}`);
17
+ return new o(t, i);
18
18
  }
19
- static fromAsset(t) {
20
- return new o(t.chain, t.symbol);
19
+ static fromAsset(r) {
20
+ return r.id ? o.from(r.id) : new o(r.chain, r.symbol);
21
21
  }
22
22
  toString() {
23
23
  return this.formatted;
package/dist/index9.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@gardenfi/utils"),d=require("./index4.cjs"),i=require("./index3.cjs"),o={[i.BlockchainType.bitcoin]:{address:(e,t)=>new s.Url("address",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("tx",e).endpoint(t).toString()},[i.BlockchainType.tron]:{address:(e,t)=>`${e}/#/address/${t}`,tx:(e,t)=>`${e}/#/transaction/${t.slice(2)}`},[i.BlockchainType.starknet]:{address:(e,t)=>new s.Url("contract",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("tx",e).endpoint(t).toString()},[i.BlockchainType.xrpl]:{address:(e,t)=>new s.Url("accounts",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("transactions",e).endpoint(t).toString()},[i.BlockchainType.solana]:{address:(e,t,n)=>{let r=new s.Url("address",e).endpoint(t);return n===s.Network.TESTNET&&(r=r.addSearchParams({cluster:"devnet"})),r.toString()},tx:(e,t,n)=>{let r=new s.Url("tx",e).endpoint(t);return n===s.Network.TESTNET&&(r=r.addSearchParams({cluster:"devnet"})),r.toString()}},default:{address:(e,t)=>new s.Url("address",e).endpoint(t).toString(),tx:(e,t)=>new s.Url("tx",e).endpoint(t).toString()}};class a{constructor(t,n,r){this.explorerUrl=n,this.network=r,this.chainType=d.getBlockchainType(t)}static from(t,n,r){return new a(t,n,r)}getAddressLink(t){return(o[this.chainType]??o.default).address(this.explorerUrl,t,this.network)}getTxLink(t){const n=this.extractTxHash(t);return(o[this.chainType]??o.default).tx(this.explorerUrl,n,this.network)}extractTxHash(t){var n,r;return((r=(n=t.split(",").at(-1))==null?void 0:n.split(":").at(0))==null?void 0:r.trim())??""}}exports.ExplorerUrlBuilder=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@gardenfi/utils"),d=require("./index4.cjs"),i=require("./index3.cjs"),o={[i.BlockchainType.bitcoin]:{address:(r,t)=>new s.Url("address",r).endpoint(t).toString(),tx:(r,t)=>new s.Url("tx",r).endpoint(t).toString()},[i.BlockchainType.tron]:{address:(r,t)=>`${r}/#/address/${t}`,tx:(r,t)=>`${r}/#/transaction/${t.slice(2)}`},[i.BlockchainType.starknet]:{address:(r,t)=>new s.Url("contract",r).endpoint(t).toString(),tx:(r,t)=>new s.Url("tx",r).endpoint(t).toString()},[i.BlockchainType.xrpl]:{address:(r,t)=>new s.Url("accounts",r).endpoint(t).toString(),tx:(r,t)=>new s.Url("transactions",r).endpoint(t).toString()},[i.BlockchainType.solana]:{address:(r,t,n)=>{let e=new s.Url("address",r).endpoint(t);return n===s.Network.TESTNET&&(e=e.addSearchParams({cluster:"devnet"})),e.toString()},tx:(r,t,n)=>{let e=new s.Url("tx",r).endpoint(t);return n===s.Network.TESTNET&&(e=e.addSearchParams({cluster:"devnet"})),e.toString()}},[i.BlockchainType.spark]:{address:(r,t,n)=>{const e=new s.Url("address",r).endpoint(t);return n===s.Network.TESTNET?e.addSearchParams({network:"regtest"}).toString():e.toString()},tx:(r,t,n)=>{const e=new s.Url("tx",r).endpoint(t);return n===s.Network.TESTNET?e.addSearchParams({network:"regtest"}).toString():e.toString()}},default:{address:(r,t)=>new s.Url("address",r).endpoint(t).toString(),tx:(r,t)=>new s.Url("tx",r).endpoint(t).toString()}};class a{constructor(t,n,e){this.explorerUrl=n,this.network=e,this.chainType=d.getBlockchainType(t)}static from(t,n,e){return new a(t,n,e)}getAddressLink(t){return(o[this.chainType]??o.default).address(this.explorerUrl,t,this.network)}getTxLink(t){const n=this.extractTxHash(t);return(o[this.chainType]??o.default).tx(this.explorerUrl,n,this.network)}extractTxHash(t){var n,e;return((e=(n=t.split(",").at(-1))==null?void 0:n.split(":").at(0))==null?void 0:e.trim())??""}}exports.ExplorerUrlBuilder=a;
package/dist/index9.js CHANGED
@@ -1,55 +1,65 @@
1
- import { Url as s, Network as d } from "@gardenfi/utils";
1
+ import { Url as s, Network as o } from "@gardenfi/utils";
2
2
  import { getBlockchainType as c } from "./index4.js";
3
3
  import { BlockchainType as i } from "./index3.js";
4
- const o = {
4
+ const d = {
5
5
  [i.bitcoin]: {
6
- address: (e, t) => new s("address", e).endpoint(t).toString(),
7
- tx: (e, t) => new s("tx", e).endpoint(t).toString()
6
+ address: (r, t) => new s("address", r).endpoint(t).toString(),
7
+ tx: (r, t) => new s("tx", r).endpoint(t).toString()
8
8
  },
9
9
  [i.tron]: {
10
- address: (e, t) => `${e}/#/address/${t}`,
11
- tx: (e, t) => `${e}/#/transaction/${t.slice(2)}`
10
+ address: (r, t) => `${r}/#/address/${t}`,
11
+ tx: (r, t) => `${r}/#/transaction/${t.slice(2)}`
12
12
  },
13
13
  [i.starknet]: {
14
- address: (e, t) => new s("contract", e).endpoint(t).toString(),
15
- tx: (e, t) => new s("tx", e).endpoint(t).toString()
14
+ address: (r, t) => new s("contract", r).endpoint(t).toString(),
15
+ tx: (r, t) => new s("tx", r).endpoint(t).toString()
16
16
  },
17
17
  [i.xrpl]: {
18
- address: (e, t) => new s("accounts", e).endpoint(t).toString(),
19
- tx: (e, t) => new s("transactions", e).endpoint(t).toString()
18
+ address: (r, t) => new s("accounts", r).endpoint(t).toString(),
19
+ tx: (r, t) => new s("transactions", r).endpoint(t).toString()
20
20
  },
21
21
  [i.solana]: {
22
- address: (e, t, n) => {
23
- let r = new s("address", e).endpoint(t);
24
- return n === d.TESTNET && (r = r.addSearchParams({ cluster: "devnet" })), r.toString();
22
+ address: (r, t, n) => {
23
+ let e = new s("address", r).endpoint(t);
24
+ return n === o.TESTNET && (e = e.addSearchParams({ cluster: "devnet" })), e.toString();
25
25
  },
26
- tx: (e, t, n) => {
27
- let r = new s("tx", e).endpoint(t);
28
- return n === d.TESTNET && (r = r.addSearchParams({ cluster: "devnet" })), r.toString();
26
+ tx: (r, t, n) => {
27
+ let e = new s("tx", r).endpoint(t);
28
+ return n === o.TESTNET && (e = e.addSearchParams({ cluster: "devnet" })), e.toString();
29
+ }
30
+ },
31
+ [i.spark]: {
32
+ address: (r, t, n) => {
33
+ const e = new s("address", r).endpoint(t);
34
+ return n === o.TESTNET ? e.addSearchParams({ network: "regtest" }).toString() : e.toString();
35
+ },
36
+ tx: (r, t, n) => {
37
+ const e = new s("tx", r).endpoint(t);
38
+ return n === o.TESTNET ? e.addSearchParams({ network: "regtest" }).toString() : e.toString();
29
39
  }
30
40
  },
31
41
  default: {
32
- address: (e, t) => new s("address", e).endpoint(t).toString(),
33
- tx: (e, t) => new s("tx", e).endpoint(t).toString()
42
+ address: (r, t) => new s("address", r).endpoint(t).toString(),
43
+ tx: (r, t) => new s("tx", r).endpoint(t).toString()
34
44
  }
35
45
  };
36
46
  class a {
37
- constructor(t, n, r) {
38
- this.explorerUrl = n, this.network = r, this.chainType = c(t);
47
+ constructor(t, n, e) {
48
+ this.explorerUrl = n, this.network = e, this.chainType = c(t);
39
49
  }
40
- static from(t, n, r) {
41
- return new a(t, n, r);
50
+ static from(t, n, e) {
51
+ return new a(t, n, e);
42
52
  }
43
53
  getAddressLink(t) {
44
- return (o[this.chainType] ?? o.default).address(this.explorerUrl, t, this.network);
54
+ return (d[this.chainType] ?? d.default).address(this.explorerUrl, t, this.network);
45
55
  }
46
56
  getTxLink(t) {
47
57
  const n = this.extractTxHash(t);
48
- return (o[this.chainType] ?? o.default).tx(this.explorerUrl, n, this.network);
58
+ return (d[this.chainType] ?? d.default).tx(this.explorerUrl, n, this.network);
49
59
  }
50
60
  extractTxHash(t) {
51
- var n, r;
52
- return ((r = (n = t.split(",").at(-1)) == null ? void 0 : n.split(":").at(0)) == null ? void 0 : r.trim()) ?? "";
61
+ var n, e;
62
+ return ((e = (n = t.split(",").at(-1)) == null ? void 0 : n.split(":").at(0)) == null ? void 0 : e.trim()) ?? "";
53
63
  }
54
64
  }
55
65
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/orderbook",
3
- "version": "3.1.3-beta.18",
3
+ "version": "3.1.3-beta.19",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@coral-xyz/anchor": "^0.31.1",
31
- "@gardenfi/utils": "3.1.1-beta.16",
31
+ "@gardenfi/utils": "3.1.1-beta.17",
32
32
  "bufferutil": "^4.0.8",
33
33
  "node-cache": "^5.1.2",
34
34
  "siwe": "^2.1.4",