@heyanon/sdk 2.0.3 → 2.1.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.
@@ -3,5 +3,6 @@ export declare enum AdapterTag {
3
3
  STAKE = "Stake",
4
4
  LENDING = "Lending",
5
5
  FARM = "Farm",
6
- PERPETUALS = "Perpetuals"
6
+ PERPETUALS = "Perpetuals",
7
+ BRIDGE = "Bridge"
7
8
  }
@@ -1,8 +1,9 @@
1
1
  import { AiTool } from '../ai';
2
- import { EVM, Solana } from '../blockchain';
3
- import { Hex, PublicClient, SignMessageReturnType, SignTypedDataParameters as ViemSignTypedDataParameters, SignTypedDataReturnType, Address } from 'viem';
2
+ import { EVM, Solana, TON } from '../blockchain';
3
+ import { Hex, PublicClient, SignMessageReturnType, SignTypedDataParameters as ViemSignTypedDataParameters, SignTypedDataReturnType, Address as EvmAddress } from 'viem';
4
4
  import { Connection, PublicKey } from '@solana/web3.js';
5
5
  import { AdapterTag } from './misc';
6
+ import { Address as TonAddress } from '@ton/ton';
6
7
  export interface FunctionReturn {
7
8
  readonly success: boolean;
8
9
  readonly data: string;
@@ -10,7 +11,7 @@ export interface FunctionReturn {
10
11
  type SignTypedDataParameters = Omit<ViemSignTypedDataParameters, 'account'>;
11
12
  export interface EvmFunctionOptions {
12
13
  readonly getProvider: (chainId: number) => PublicClient;
13
- readonly getRecipient: () => Promise<Address>;
14
+ readonly getRecipient: () => Promise<EvmAddress>;
14
15
  readonly sendTransactions: (props: EVM.types.SendTransactionProps) => Promise<EVM.types.TransactionReturn>;
15
16
  readonly signMessages?: (messages: Hex[]) => Promise<SignMessageReturnType[]>;
16
17
  readonly signTypedDatas?: (args: SignTypedDataParameters[]) => Promise<SignTypedDataReturnType[]>;
@@ -21,9 +22,15 @@ export interface SolanaFunctionOptions {
21
22
  readonly getPublicKey: () => Promise<PublicKey>;
22
23
  readonly sendTransactions: (props: Solana.types.SendTransactionProps) => Promise<Solana.types.TransactionReturn>;
23
24
  }
25
+ export interface TonFunctionOptions {
26
+ readonly getAddress: () => Promise<TonAddress>;
27
+ readonly getClient: () => Promise<TON.types.Client>;
28
+ readonly sendTransactions: (props: TON.types.SendTransactionProps) => Promise<TON.types.TransactionReturn>;
29
+ }
24
30
  export interface FunctionOptions {
25
31
  readonly evm: EvmFunctionOptions;
26
32
  readonly solana: SolanaFunctionOptions;
33
+ readonly ton: TonFunctionOptions;
27
34
  readonly notify: (message: string) => Promise<void>;
28
35
  }
29
36
  export interface AdapterExport {
@@ -13,8 +13,9 @@ export declare enum Chain {
13
13
  AVALANCHE = "avalanche",
14
14
  ARBITRUM = "arbitrum",
15
15
  SCROLL = "scroll",
16
- SOLANA = "solana"
16
+ SOLANA = "solana",
17
+ TON = "ton"
17
18
  }
18
- export type EvmChain = Exclude<Chain, Chain.SOLANA>;
19
+ export type EvmChain = Exclude<Chain, Chain.SOLANA | Chain.TON>;
19
20
  export declare const allChains: Chain[];
20
21
  export declare const allEvmChains: (Chain.ETHEREUM | Chain.OPTIMISM | Chain.BSC | Chain.GNOSIS | Chain.POLYGON | Chain.SONIC | Chain.ZKSYNC | Chain.METIS | Chain.KAVA_EVM | Chain.BASE | Chain.IOTA_EVM | Chain.AVALANCHE | Chain.ARBITRUM | Chain.SCROLL)[];
@@ -1,3 +1,4 @@
1
1
  export * as EVM from './evm';
2
2
  export * as Solana from './solana';
3
+ export * as TON from './ton';
3
4
  export * from './constants';
@@ -0,0 +1 @@
1
+ export * as types from './types';
@@ -0,0 +1,19 @@
1
+ import { SenderArguments } from '@ton/core';
2
+ import { TonApiClient } from '@ton-api/client';
3
+ import { ContractAdapter } from '@ton-api/ton-adapter';
4
+ import { Address } from '@ton/ton';
5
+ export interface TransactionReturnData {
6
+ readonly message: string;
7
+ readonly hash: string;
8
+ }
9
+ export interface TransactionReturn {
10
+ readonly data: TransactionReturnData[];
11
+ }
12
+ export interface SendTransactionProps {
13
+ readonly account: Address;
14
+ readonly transactions: SenderArguments[];
15
+ }
16
+ export interface Client {
17
+ readonly api: TonApiClient;
18
+ readonly adapter: ContractAdapter;
19
+ }
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ var AdapterTag = /* @__PURE__ */ ((AdapterTag2) => {
25
25
  AdapterTag2["LENDING"] = "Lending";
26
26
  AdapterTag2["FARM"] = "Farm";
27
27
  AdapterTag2["PERPETUALS"] = "Perpetuals";
28
+ AdapterTag2["BRIDGE"] = "Bridge";
28
29
  return AdapterTag2;
29
30
  })(AdapterTag || {});
30
31
 
@@ -121,10 +122,11 @@ var Chain = /* @__PURE__ */ ((Chain2) => {
121
122
  Chain2["ARBITRUM"] = "arbitrum";
122
123
  Chain2["SCROLL"] = "scroll";
123
124
  Chain2["SOLANA"] = "solana";
125
+ Chain2["TON"] = "ton";
124
126
  return Chain2;
125
127
  })(Chain || {});
126
128
  var allChains = Object.values(Chain);
127
- var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */);
129
+ var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */ && chain !== "ton" /* TON */);
128
130
  var WETH9 = {
129
131
  ["ethereum" /* ETHEREUM */]: sdk.ethereumTokens.weth,
130
132
  ["optimism" /* OPTIMISM */]: sdk.optimismTokens.weth,
@@ -510,6 +512,15 @@ function toPublicKey(publicKey) {
510
512
  }
511
513
  }
512
514
 
515
+ // src/blockchain/ton/index.ts
516
+ var ton_exports = {};
517
+ __export(ton_exports, {
518
+ types: () => types_exports3
519
+ });
520
+
521
+ // src/blockchain/ton/types.ts
522
+ var types_exports3 = {};
523
+
513
524
  // src/utils/retry.ts
514
525
  function delay(ms) {
515
526
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -537,6 +548,7 @@ exports.AdapterTag = AdapterTag;
537
548
  exports.Chain = Chain;
538
549
  exports.EVM = evm_exports;
539
550
  exports.Solana = solana_exports;
551
+ exports.TON = ton_exports;
540
552
  exports.allChains = allChains;
541
553
  exports.allEvmChains = allEvmChains;
542
554
  exports.retry = retry;
package/dist/index.mjs CHANGED
@@ -23,6 +23,7 @@ var AdapterTag = /* @__PURE__ */ ((AdapterTag2) => {
23
23
  AdapterTag2["LENDING"] = "Lending";
24
24
  AdapterTag2["FARM"] = "Farm";
25
25
  AdapterTag2["PERPETUALS"] = "Perpetuals";
26
+ AdapterTag2["BRIDGE"] = "Bridge";
26
27
  return AdapterTag2;
27
28
  })(AdapterTag || {});
28
29
 
@@ -119,10 +120,11 @@ var Chain = /* @__PURE__ */ ((Chain2) => {
119
120
  Chain2["ARBITRUM"] = "arbitrum";
120
121
  Chain2["SCROLL"] = "scroll";
121
122
  Chain2["SOLANA"] = "solana";
123
+ Chain2["TON"] = "ton";
122
124
  return Chain2;
123
125
  })(Chain || {});
124
126
  var allChains = Object.values(Chain);
125
- var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */);
127
+ var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */ && chain !== "ton" /* TON */);
126
128
  var WETH9 = {
127
129
  ["ethereum" /* ETHEREUM */]: ethereumTokens.weth,
128
130
  ["optimism" /* OPTIMISM */]: optimismTokens.weth,
@@ -508,6 +510,15 @@ function toPublicKey(publicKey) {
508
510
  }
509
511
  }
510
512
 
513
+ // src/blockchain/ton/index.ts
514
+ var ton_exports = {};
515
+ __export(ton_exports, {
516
+ types: () => types_exports3
517
+ });
518
+
519
+ // src/blockchain/ton/types.ts
520
+ var types_exports3 = {};
521
+
511
522
  // src/utils/retry.ts
512
523
  function delay(ms) {
513
524
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -531,4 +542,4 @@ async function retry(fn, options) {
531
542
  // src/utils/sleep.ts
532
543
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
533
544
 
534
- export { AdapterTag, Chain, evm_exports as EVM, solana_exports as Solana, allChains, allEvmChains, retry, sleep, toResult };
545
+ export { AdapterTag, Chain, evm_exports as EVM, solana_exports as Solana, ton_exports as TON, allChains, allEvmChains, retry, sleep, toResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyanon/sdk",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -43,6 +43,10 @@
43
43
  "dependencies": {
44
44
  "@real-wagmi/sdk": "^1.4.5",
45
45
  "@solana/web3.js": "^1.98.0",
46
+ "@ton-api/client": "^0.3.1",
47
+ "@ton-api/ton-adapter": "0.3.0",
48
+ "@ton/core": "^0.60.0",
49
+ "@ton/ton": "^15.2.0",
46
50
  "viem": "^2.22.7",
47
51
  "vitest": "^2.1.8"
48
52
  }