@heyanon/sdk 2.0.4 → 2.1.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.
@@ -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,24 @@
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
+ }
20
+ export declare enum WalletType {
21
+ V3R2 = "v3r2",
22
+ V4 = "v4",
23
+ V5R1 = "v5r1"
24
+ }
package/dist/index.js CHANGED
@@ -122,10 +122,11 @@ var Chain = /* @__PURE__ */ ((Chain2) => {
122
122
  Chain2["ARBITRUM"] = "arbitrum";
123
123
  Chain2["SCROLL"] = "scroll";
124
124
  Chain2["SOLANA"] = "solana";
125
+ Chain2["TON"] = "ton";
125
126
  return Chain2;
126
127
  })(Chain || {});
127
128
  var allChains = Object.values(Chain);
128
- var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */);
129
+ var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */ && chain !== "ton" /* TON */);
129
130
  var WETH9 = {
130
131
  ["ethereum" /* ETHEREUM */]: sdk.ethereumTokens.weth,
131
132
  ["optimism" /* OPTIMISM */]: sdk.optimismTokens.weth,
@@ -511,6 +512,24 @@ function toPublicKey(publicKey) {
511
512
  }
512
513
  }
513
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
+ __export(types_exports3, {
524
+ WalletType: () => WalletType
525
+ });
526
+ var WalletType = /* @__PURE__ */ ((WalletType2) => {
527
+ WalletType2["V3R2"] = "v3r2";
528
+ WalletType2["V4"] = "v4";
529
+ WalletType2["V5R1"] = "v5r1";
530
+ return WalletType2;
531
+ })(WalletType || {});
532
+
514
533
  // src/utils/retry.ts
515
534
  function delay(ms) {
516
535
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -538,6 +557,7 @@ exports.AdapterTag = AdapterTag;
538
557
  exports.Chain = Chain;
539
558
  exports.EVM = evm_exports;
540
559
  exports.Solana = solana_exports;
560
+ exports.TON = ton_exports;
541
561
  exports.allChains = allChains;
542
562
  exports.allEvmChains = allEvmChains;
543
563
  exports.retry = retry;
package/dist/index.mjs CHANGED
@@ -120,10 +120,11 @@ var Chain = /* @__PURE__ */ ((Chain2) => {
120
120
  Chain2["ARBITRUM"] = "arbitrum";
121
121
  Chain2["SCROLL"] = "scroll";
122
122
  Chain2["SOLANA"] = "solana";
123
+ Chain2["TON"] = "ton";
123
124
  return Chain2;
124
125
  })(Chain || {});
125
126
  var allChains = Object.values(Chain);
126
- var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */);
127
+ var allEvmChains = Object.values(Chain).filter((chain) => chain !== "solana" /* SOLANA */ && chain !== "ton" /* TON */);
127
128
  var WETH9 = {
128
129
  ["ethereum" /* ETHEREUM */]: ethereumTokens.weth,
129
130
  ["optimism" /* OPTIMISM */]: optimismTokens.weth,
@@ -509,6 +510,24 @@ function toPublicKey(publicKey) {
509
510
  }
510
511
  }
511
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
+ __export(types_exports3, {
522
+ WalletType: () => WalletType
523
+ });
524
+ var WalletType = /* @__PURE__ */ ((WalletType2) => {
525
+ WalletType2["V3R2"] = "v3r2";
526
+ WalletType2["V4"] = "v4";
527
+ WalletType2["V5R1"] = "v5r1";
528
+ return WalletType2;
529
+ })(WalletType || {});
530
+
512
531
  // src/utils/retry.ts
513
532
  function delay(ms) {
514
533
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -532,4 +551,4 @@ async function retry(fn, options) {
532
551
  // src/utils/sleep.ts
533
552
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
534
553
 
535
- export { AdapterTag, Chain, evm_exports as EVM, solana_exports as Solana, allChains, allEvmChains, retry, sleep, toResult };
554
+ 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.4",
3
+ "version": "2.1.1",
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
  }