@gardenfi/orderbook 2.5.2 → 2.5.3-beta.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/dist/index5.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(o,i,e)=>{const t=o.endpoint(i);return e&&Object.entries(e).forEach(([n,r])=>{r!==void 0&&(Array.isArray(r)?t.searchParams.append(n,r.join(",")):t.searchParams.append(n,r.toString()))}),t};exports.ConstructUrl=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={id:1001,name:"Starknet Localnet",nativeCurrency:{name:"Stark Token",symbol:"STRK",decimals:18},rpcUrls:{default:{http:["http://127.0.0.1:8547/"]}},testnet:!0},t={id:31338,name:"Arbitrum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8546/"]}},testnet:!0},a={id:31337,name:"Ethereum Localnet",nativeCurrency:{name:"Ethereum",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8545/"]}},testnet:!0},s={name:"SOL Solana Localnet",decimals:9,symbol:"SOL",atomicSwapAddress:"primary",tokenAddress:"primary"},n={name:"Bitcoin Regtest",decimals:8,symbol:"BTC",atomicSwapAddress:"primary",tokenAddress:"primary"},c={name:"WBTC Arbitrum Localnet",decimals:8,symbol:"WBTC",atomicSwapAddress:"0x0165878A594ca255338adfa4d48449f69242Eb8F",tokenAddress:"0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"},o={name:"WBTC Ethereum Localnet",decimals:8,symbol:"WBTC",atomicSwapAddress:"0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",tokenAddress:"0x5FbDB2315678afecb367f032d93F642f64180aa3"},r={name:"STRK Starknet Localnet",decimals:18,symbol:"STRK",atomicSwapAddress:"0x15cf8b127aa850c97ed10de6f8b300cabc4f09232a57e63667af02fdef8a55a",tokenAddress:"0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"},l={name:"ETH Starknet Localnet",decimals:18,symbol:"ETH",atomicSwapAddress:"0x1890470168440bbb9df50988748924a74ea22de10d22a081e458737b9574e75",tokenAddress:"0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"};exports.ArbitrumLocalnet=t;exports.ETHStarknetLocalnetAsset=l;exports.EthereumLocalnet=a;exports.SOLSolanaLocalnetAsset=s;exports.STRKStarknetLocalnetAsset=r;exports.StarknetLocalnet=e;exports.WBTCArbitrumLocalnetAsset=c;exports.WBTCEthereumLocalnetAsset=o;exports.bitcoinRegtestAsset=n;
package/dist/index5.js CHANGED
@@ -1,9 +1,94 @@
1
- const e = (o, s, t) => {
2
- const n = o.endpoint(s);
3
- return t && Object.entries(t).forEach(([i, r]) => {
4
- r !== void 0 && (Array.isArray(r) ? n.searchParams.append(i, r.join(",")) : n.searchParams.append(i, r.toString()));
5
- }), n;
1
+ const e = {
2
+ id: 1001,
3
+ name: "Starknet Localnet",
4
+ nativeCurrency: {
5
+ name: "Stark Token",
6
+ symbol: "STRK",
7
+ decimals: 18
8
+ },
9
+ rpcUrls: {
10
+ default: {
11
+ http: ["http://127.0.0.1:8547/"]
12
+ }
13
+ },
14
+ testnet: !0
15
+ }, t = {
16
+ id: 31338,
17
+ name: "Arbitrum Localnet",
18
+ nativeCurrency: {
19
+ name: "Ethereum",
20
+ symbol: "ETH",
21
+ decimals: 18
22
+ },
23
+ rpcUrls: {
24
+ default: {
25
+ http: ["http://localhost:8546/"]
26
+ }
27
+ },
28
+ testnet: !0
29
+ }, a = {
30
+ id: 31337,
31
+ name: "Ethereum Localnet",
32
+ nativeCurrency: {
33
+ name: "Ethereum",
34
+ symbol: "ETH",
35
+ decimals: 18
36
+ },
37
+ rpcUrls: {
38
+ default: {
39
+ http: ["http://localhost:8545/"]
40
+ }
41
+ },
42
+ testnet: !0
43
+ }, s = {
44
+ name: "SOL Solana Localnet",
45
+ decimals: 9,
46
+ symbol: "SOL",
47
+ atomicSwapAddress: "primary",
48
+ tokenAddress: "primary"
49
+ }, c = {
50
+ name: "Bitcoin Regtest",
51
+ decimals: 8,
52
+ symbol: "BTC",
53
+ atomicSwapAddress: "primary",
54
+ tokenAddress: "primary"
55
+ }, n = {
56
+ name: "WBTC Arbitrum Localnet",
57
+ decimals: 8,
58
+ symbol: "WBTC",
59
+ // atomicSwapAddress: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
60
+ atomicSwapAddress: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
61
+ //present on localnet
62
+ tokenAddress: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
63
+ }, r = {
64
+ name: "WBTC Ethereum Localnet",
65
+ decimals: 8,
66
+ symbol: "WBTC",
67
+ // atomicSwapAddress: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
68
+ atomicSwapAddress: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
69
+ //present on localnet
70
+ tokenAddress: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
71
+ }, o = {
72
+ name: "STRK Starknet Localnet",
73
+ decimals: 18,
74
+ symbol: "STRK",
75
+ atomicSwapAddress: "0x15cf8b127aa850c97ed10de6f8b300cabc4f09232a57e63667af02fdef8a55a",
76
+ tokenAddress: "0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"
77
+ }, d = {
78
+ name: "ETH Starknet Localnet",
79
+ decimals: 18,
80
+ symbol: "ETH",
81
+ atomicSwapAddress: "0x1890470168440bbb9df50988748924a74ea22de10d22a081e458737b9574e75",
82
+ tokenAddress: "0x51aa025f1c9948790113e4ebea826dee24542bc50902076c05892774210e8d2"
6
83
  };
7
84
  export {
8
- e as ConstructUrl
85
+ t as ArbitrumLocalnet,
86
+ d as ETHStarknetLocalnetAsset,
87
+ a as EthereumLocalnet,
88
+ s as SOLSolanaLocalnetAsset,
89
+ o as STRKStarknetLocalnetAsset,
90
+ e as StarknetLocalnet,
91
+ n as WBTCArbitrumLocalnetAsset,
92
+ r as WBTCEthereumLocalnetAsset,
93
+ c as bitcoinRegtestAsset
9
94
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function u(n){const e={};for(const t of Object.keys(n)){const i=n[t],{network:a,type:b,...o}=i,s={};for(const c of Object.keys(o)){const r=o[c];s[c]={...r,chain:t}}e[t]=s}return e}exports.buildAssetsWithChain=u;
package/dist/index6.js ADDED
@@ -0,0 +1,18 @@
1
+ function h(n) {
2
+ const o = {};
3
+ for (const t of Object.keys(n)) {
4
+ const i = n[t], { network: r, type: a, ...e } = i, s = {};
5
+ for (const c of Object.keys(e)) {
6
+ const k = e[c];
7
+ s[c] = {
8
+ ...k,
9
+ chain: t
10
+ };
11
+ }
12
+ o[t] = s;
13
+ }
14
+ return o;
15
+ }
16
+ export {
17
+ h as buildAssetsWithChain
18
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@gardenfi/utils"),i=require("./index3.cjs"),p=(t,r,d)=>{const a=t.endpoint(r);return d&&Object.entries(d).forEach(([l,n])=>{n!==void 0&&(Array.isArray(n)?a.searchParams.append(l,n.join(",")):a.searchParams.append(l,n.toString()))}),a},c=t=>e.hasKeys(t,["typed_data","initiate_transaction"])&&typeof t.initiate_transaction=="object"&&t.initiate_transaction&&e.hasKeys(t.initiate_transaction,["to","value","data","gas_limit","chain_id"]),o=t=>e.hasKeys(t,["typed_data","initiate_transaction"])&&typeof t.initiate_transaction=="object"&&t.initiate_transaction&&e.hasKeys(t.initiate_transaction,["to","selector","calldata"]),s=t=>e.hasKeys(t,["to","amount"])&&typeof t.to=="string"&&typeof t.amount=="number",y=t=>e.hasKeys(t,["versioned_tx"])&&typeof t.versioned_tx=="string",u=t=>e.hasKeys(t,["ptb_bytes"])&&Array.isArray(t.ptb_bytes)&&t.ptb_bytes.every(r=>typeof r=="number"),f=t=>e.hasKeys(t,["source_swap","destination_swap"])&&typeof t.source_swap=="object"&&typeof t.destination_swap=="object";function h(t){return c(t)?{type:i.BlockchainType.evm,...t}:o(t)?{type:i.BlockchainType.starknet,...t}:s(t)?{type:i.BlockchainType.bitcoin,...t}:y(t)?{type:i.BlockchainType.solana,...t}:u(t)?{type:i.BlockchainType.sui,...t}:null}function _(t){return c(t)?i.BlockchainType.evm:o(t)?i.BlockchainType.starknet:s(t)?i.BlockchainType.bitcoin:y(t)?i.BlockchainType.solana:u(t)?i.BlockchainType.sui:null}exports.ConstructUrl=p;exports.discriminateOrderResponse=h;exports.getOrderResponseType=_;exports.isBitcoinOrderResponse=s;exports.isEvmOrderResponse=c;exports.isOrder=f;exports.isSolanaOrderResponse=y;exports.isStarknetOrderResponse=o;exports.isSuiOrderResponse=u;
package/dist/index7.js ADDED
@@ -0,0 +1,46 @@
1
+ import { hasKeys as r } from "@gardenfi/utils";
2
+ import { BlockchainType as i } from "./index3.js";
3
+ const m = (t, a, o) => {
4
+ const e = t.endpoint(a);
5
+ return o && Object.entries(o).forEach(([c, n]) => {
6
+ n !== void 0 && (Array.isArray(n) ? e.searchParams.append(c, n.join(",")) : e.searchParams.append(c, n.toString()));
7
+ }), e;
8
+ }, u = (t) => r(t, ["typed_data", "initiate_transaction"]) && typeof t.initiate_transaction == "object" && t.initiate_transaction && r(t.initiate_transaction, [
9
+ "to",
10
+ "value",
11
+ "data",
12
+ "gas_limit",
13
+ "chain_id"
14
+ ]), f = (t) => r(t, ["typed_data", "initiate_transaction"]) && typeof t.initiate_transaction == "object" && t.initiate_transaction && r(t.initiate_transaction, ["to", "selector", "calldata"]), y = (t) => r(t, ["to", "amount"]) && typeof t.to == "string" && typeof t.amount == "number", d = (t) => r(t, ["versioned_tx"]) && typeof t.versioned_tx == "string", _ = (t) => r(t, ["ptb_bytes"]) && Array.isArray(t.ptb_bytes) && t.ptb_bytes.every((a) => typeof a == "number"), l = (t) => r(t, ["source_swap", "destination_swap"]) && typeof t.source_swap == "object" && typeof t.destination_swap == "object";
15
+ function p(t) {
16
+ return u(t) ? {
17
+ type: i.evm,
18
+ ...t
19
+ } : f(t) ? {
20
+ type: i.starknet,
21
+ ...t
22
+ } : y(t) ? {
23
+ type: i.bitcoin,
24
+ ...t
25
+ } : d(t) ? {
26
+ type: i.solana,
27
+ ...t
28
+ } : _(t) ? {
29
+ type: i.sui,
30
+ ...t
31
+ } : null;
32
+ }
33
+ function O(t) {
34
+ return u(t) ? i.evm : f(t) ? i.starknet : y(t) ? i.bitcoin : d(t) ? i.solana : _(t) ? i.sui : null;
35
+ }
36
+ export {
37
+ m as ConstructUrl,
38
+ p as discriminateOrderResponse,
39
+ O as getOrderResponseType,
40
+ y as isBitcoinOrderResponse,
41
+ u as isEvmOrderResponse,
42
+ l as isOrder,
43
+ d as isSolanaOrderResponse,
44
+ f as isStarknetOrderResponse,
45
+ _ as isSuiOrderResponse
46
+ };
@@ -0,0 +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}}exports.ChainAsset=o;
package/dist/index8.js ADDED
@@ -0,0 +1,28 @@
1
+ import { getBlockchainType as i, Config as e, Assets as f, Chains as s } from "./index4.js";
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];
5
+ }
6
+ /* ---------------- factories ---------------- */
7
+ static from(t) {
8
+ return t instanceof o ? t : typeof t == "string" ? o.fromString(t) : o.fromAsset(t);
9
+ }
10
+ static fromChainAndSymbol(t, r) {
11
+ return new o(t, r);
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);
18
+ }
19
+ static fromAsset(t) {
20
+ return new o(t.chain, t.symbol);
21
+ }
22
+ toString() {
23
+ return this.formatted;
24
+ }
25
+ }
26
+ export {
27
+ o as ChainAsset
28
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index4.cjs"),u=t=>{const{created_at:n,source_swap:r,destination_swap:d}=t;if(d.redeem_tx_hash)return Number(d.redeem_block_number)||e.isBitcoin(d.chain)?e.OrderStatus.Redeemed:e.OrderStatus.RedeemDetected;if(e.isBitcoin(d.chain)&&r.redeem_tx_hash&&!d.redeem_tx_hash)return e.OrderStatus.Redeemed;if(r.refund_tx_hash)return Number(r.refund_block_number)?e.OrderStatus.Refunded:e.OrderStatus.RefundDetected;if(d.refund_tx_hash)return e.OrderStatus.AwaitingRefund;const a=e.isBitcoin(r.chain)?s(new Date(n),6):s(new Date(n),1);return d.initiate_tx_hash?e.OrderStatus.AwaitingRedeem:r.initiate_tx_hash?a?e.OrderStatus.AwaitingRefund:Number(r.initiate_block_number)?e.OrderStatus.Initiated:e.OrderStatus.InitiateDetected:a?e.OrderStatus.Expired:e.OrderStatus.Created},s=(t,n=1)=>{const r=new Date,d=new Date(t);return d.setHours(d.getHours()+n),r>d},_=t=>{const n=u(t);return n===e.OrderStatus.Redeemed||n===e.OrderStatus.Refunded||n===e.OrderStatus.Expired};var i=(t=>(t.Initiate="Initiate",t.PostRefundSACP="PostRefundSACP",t.Redeem="Redeem",t.Refund="Refund",t.Idle="Idle",t))(i||{});const o=t=>{const{source_swap:n,destination_swap:r}=t;return r.redeem_tx_hash&&Number(r.redeem_block_number)||n.refund_tx_hash&&Number(n.refund_block_number)?"Idle":!r.refund_tx_hash&&r.initiate_tx_hash?"Redeem":"Idle"};exports.OrderAction=i;exports.ParseOrderStatus=u;exports.isCompleted=_;exports.isDeadlinePassed=s;exports.parseAction=o;
package/dist/index9.js ADDED
@@ -0,0 +1,31 @@
1
+ import { OrderStatus as e, isBitcoin as d } from "./index4.js";
2
+ const s = (t) => {
3
+ const { created_at: r, source_swap: n, destination_swap: i } = t;
4
+ if (i.redeem_tx_hash)
5
+ return Number(i.redeem_block_number) ? e.Redeemed : d(i.chain) ? e.Redeemed : e.RedeemDetected;
6
+ if (d(i.chain) && n.redeem_tx_hash && !i.redeem_tx_hash)
7
+ return e.Redeemed;
8
+ if (n.refund_tx_hash)
9
+ return Number(n.refund_block_number) ? e.Refunded : e.RefundDetected;
10
+ if (i.refund_tx_hash) return e.AwaitingRefund;
11
+ const u = d(n.chain) ? a(new Date(r), 6) : a(new Date(r), 1);
12
+ return i.initiate_tx_hash ? e.AwaitingRedeem : n.initiate_tx_hash ? u ? e.AwaitingRefund : Number(n.initiate_block_number) ? e.Initiated : e.InitiateDetected : u ? e.Expired : e.Created;
13
+ }, a = (t, r = 1) => {
14
+ const n = /* @__PURE__ */ new Date(), i = new Date(t);
15
+ return i.setHours(i.getHours() + r), n > i;
16
+ }, m = (t) => {
17
+ const r = s(t);
18
+ return r === e.Redeemed || r === e.Refunded || r === e.Expired;
19
+ };
20
+ var _ = /* @__PURE__ */ ((t) => (t.Initiate = "Initiate", t.PostRefundSACP = "PostRefundSACP", t.Redeem = "Redeem", t.Refund = "Refund", t.Idle = "Idle", t))(_ || {});
21
+ const o = (t) => {
22
+ const { source_swap: r, destination_swap: n } = t;
23
+ return n.redeem_tx_hash && Number(n.redeem_block_number) || r.refund_tx_hash && Number(r.refund_block_number) ? "Idle" : !n.refund_tx_hash && n.initiate_tx_hash ? "Redeem" : "Idle";
24
+ };
25
+ export {
26
+ _ as OrderAction,
27
+ s as ParseOrderStatus,
28
+ m as isCompleted,
29
+ a as isDeadlinePassed,
30
+ o as parseAction
31
+ };
@@ -1,4 +1,11 @@
1
1
  export { Orderbook } from './lib/orderbook/orderbook';
2
2
  export type * from './lib/orderbook/orderbook.types';
3
- export * from './lib/asset';
4
- export * from './lib/constants';
3
+ export { BlockchainType } from './lib/constants/asset.types';
4
+ export type { Asset, AssetCommon, AssetToken, BitcoinChains, Chain, ChainsByBlockchainType, ChainsByNetwork, EVMChains, LocalnetOnlyChains, MainnetOnlyChains, SolanaChains, SuiChains, StarknetChains, TestnetOnlyChains, } from './lib/constants/asset.types';
5
+ export * from './lib/constants/asset';
6
+ export * from './lib/constants/localnetConstants';
7
+ export * from './lib/constants/utils';
8
+ export { isSuiOrderResponse, ConstructUrl, discriminateOrderResponse, getOrderResponseType, isBitcoinOrderResponse, isEvmOrderResponse, isOrder, isSolanaOrderResponse, isStarknetOrderResponse, } from './lib/utils';
9
+ export { ChainAsset } from './lib/chainAsset/chainAsset';
10
+ export type { ChainAssetString, AssetLike } from './lib/chainAsset/chainAsset';
11
+ export { OrderAction, ParseOrderStatus, isCompleted, isDeadlinePassed, parseAction, } from './lib/orderStatus/orderStatus';
@@ -1,2 +1,2 @@
1
1
  export declare const MAINNET_ORDERBOOK_API = "https://api.garden.finance";
2
- export declare const TESTNET_ORDERBOOK_API = "https://orderbook-testnet.garden.finance";
2
+ export declare const TESTNET_ORDERBOOK_API = "https://testnet.api.garden.finance";
@@ -1,80 +0,0 @@
1
- export type AssetCommon = {
2
- name: string;
3
- decimals: number;
4
- symbol: string;
5
- chain: Chain;
6
- logo?: string;
7
- atomicSwapAddress: string;
8
- };
9
- export type AssetToken = AssetCommon & {
10
- tokenAddress: string;
11
- };
12
- export type Asset = AssetToken;
13
- export declare enum BlockchainType {
14
- Bitcoin = "Bitcoin",
15
- EVM = "EVM",
16
- Solana = "Solana",
17
- Starknet = "Starknet",
18
- Sui = "Sui"
19
- }
20
- export declare enum NetworkType {
21
- mainnet = "mainnet",
22
- testnet = "testnet",
23
- localnet = "localnet"
24
- }
25
- export type Network = {
26
- [networkName: string]: {
27
- chainId: number;
28
- fillerAddresses: string[];
29
- networkLogo: string;
30
- explorer: string;
31
- networkType: NetworkType;
32
- assets?: Asset[];
33
- };
34
- };
35
- export declare const Chains: {
36
- readonly bitcoin: "bitcoin";
37
- readonly bitcoin_testnet: "bitcoin_testnet";
38
- readonly bitcoin_regtest: "bitcoin_regtest";
39
- readonly ethereum: "ethereum";
40
- readonly base: "base";
41
- readonly arbitrum: "arbitrum";
42
- readonly ethereum_sepolia: "ethereum_sepolia";
43
- readonly arbitrum_localnet: "arbitrum_localnet";
44
- readonly arbitrum_sepolia: "arbitrum_sepolia";
45
- readonly ethereum_localnet: "ethereum_localnet";
46
- readonly base_sepolia: "base_sepolia";
47
- readonly solana: "solana";
48
- readonly solana_testnet: "solana_testnet";
49
- readonly solana_localnet: "solana_localnet";
50
- readonly bera_testnet: "bera_testnet";
51
- readonly citrea_testnet: "citrea_testnet";
52
- readonly bera: "bera";
53
- readonly monad_testnet: "monad_testnet";
54
- readonly starknet: "starknet";
55
- readonly starknet_sepolia: "starknet_sepolia";
56
- readonly starknet_devnet: "starknet_devnet";
57
- readonly hyperliquid_testnet: "hyperliquid_testnet";
58
- readonly hyperliquid: "hyperliquid";
59
- readonly unichain: "unichain";
60
- readonly corn: "corn";
61
- readonly botanix: "botanix";
62
- readonly bnbchain: "bnbchain";
63
- readonly bnbchain_testnet: "bnbchain_testnet";
64
- readonly sui: "sui";
65
- readonly sui_testnet: "sui_testnet";
66
- };
67
- export type Chain = keyof typeof Chains;
68
- export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest' | 'solana' | 'solana_testnet' | 'solana_localnet' | 'starknet' | 'starknet_devnet' | 'starknet_sepolia' | 'sui' | 'sui_testnet'>;
69
- export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "base" | "arbitrum" | "solana" | "bera" | "starknet" | "hyperliquid" | "unichain" | "corn" | "botanix" | "bnbchain" | "sui";
70
- export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest";
71
- export declare const isEVM: (chain: Chain) => chain is "ethereum" | "base" | "arbitrum" | "ethereum_sepolia" | "arbitrum_localnet" | "arbitrum_sepolia" | "ethereum_localnet" | "base_sepolia" | "bera_testnet" | "citrea_testnet" | "bera" | "monad_testnet" | "hyperliquid_testnet" | "hyperliquid" | "unichain" | "corn" | "botanix" | "bnbchain" | "bnbchain_testnet";
72
- export declare const isSolana: (chain: Chain) => chain is "solana" | "solana_testnet" | "solana_localnet";
73
- export declare const isStarknet: (chain: Chain) => chain is "starknet" | "starknet_sepolia" | "starknet_devnet";
74
- export declare const isSui: (chain: Chain) => chain is "sui" | "sui_testnet";
75
- export declare const getBlockchainType: (chain: Chain) => BlockchainType;
76
- export declare const NativeTokenAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
77
- export declare const isEvmNativeToken: (chain: Chain, tokenAddress: string) => boolean;
78
- export declare const isSolanaNativeToken: (chain: Chain, tokenAddress: string) => boolean;
79
- export declare const isSuiNativeToken: (chain: Chain, tokenAddress: string) => boolean;
80
- export declare const isNativeToken: (asset: Asset) => boolean;
@@ -0,0 +1,19 @@
1
+ import { Network } from '@gardenfi/utils';
2
+ import { Asset, BlockchainType, Chain } from '../constants/asset.types';
3
+
4
+ export type ChainAssetString = `${Chain}:${string}`;
5
+ export type AssetLike = Asset | ChainAssetString | ChainAsset | string;
6
+ export declare class ChainAsset {
7
+ chain: Chain;
8
+ symbol: string;
9
+ blockchainType: BlockchainType;
10
+ formatted: ChainAssetString;
11
+ network: Network;
12
+ asset: Asset;
13
+ constructor(chain: Chain, symbol: string);
14
+ static from(asset: AssetLike): ChainAsset;
15
+ static fromChainAndSymbol(chain: Chain, symbol: string): ChainAsset;
16
+ static fromString(formatted: ChainAssetString | string): ChainAsset;
17
+ static fromAsset(asset: Asset): ChainAsset;
18
+ toString(): string;
19
+ }