@swapkit/helpers 1.0.0-rc.103 → 1.0.0-rc.105

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/package.json CHANGED
@@ -38,5 +38,5 @@
38
38
  },
39
39
  "type": "module",
40
40
  "types": "./src/index.ts",
41
- "version": "1.0.0-rc.103"
41
+ "version": "1.0.0-rc.105"
42
42
  }
@@ -25,7 +25,7 @@ describe("getMemoFor", () => {
25
25
  });
26
26
 
27
27
  test("returns correct memo for Thorname Register", () => {
28
- const result = getMemoFor(MemoType.THORNAME_REGISTER, {
28
+ const result = getMemoFor(MemoType.NAME_REGISTER, {
29
29
  name: "thorname",
30
30
  chain: "BNB",
31
31
  address: "0xABC123",
@@ -35,7 +35,7 @@ describe("getMemoFor", () => {
35
35
  });
36
36
 
37
37
  test("returns correct memo for Mayaname Register", () => {
38
- const result = getMemoFor(MemoType.THORNAME_REGISTER, {
38
+ const result = getMemoFor(MemoType.NAME_REGISTER, {
39
39
  name: "mayaname",
40
40
  chain: "BNB",
41
41
  address: "0xABC123",
@@ -1,3 +1,4 @@
1
+ import { AssetValue } from "../modules/assetValue.ts";
1
2
  import { RequestClient } from "../modules/requestClient.ts";
2
3
  import { BaseDecimal, Chain, ChainToRPC, type EVMChain, EVMChains } from "../types/chains.ts";
3
4
  import type { TokenNames } from "../types/tokens.ts";
@@ -72,6 +73,25 @@ export const getDecimal = ({ chain, symbol }: { chain: Chain; symbol: string })
72
73
  }
73
74
  };
74
75
 
76
+ export const getGasAsset = ({ chain }: { chain: Chain }) => {
77
+ switch (chain) {
78
+ case Chain.Arbitrum:
79
+ case Chain.Optimism:
80
+ return AssetValue.fromStringSync(`${chain}.ETH`);
81
+ case Chain.Maya:
82
+ return AssetValue.fromStringSync(`${chain}.CACAO`);
83
+ case Chain.Cosmos:
84
+ return AssetValue.fromStringSync(`${chain}.ATOM`);
85
+ case Chain.BinanceSmartChain:
86
+ return AssetValue.fromStringSync(`${chain}.BNB`);
87
+ case Chain.THORChain:
88
+ return AssetValue.fromStringSync(`${chain}.RUNE`);
89
+
90
+ default:
91
+ return AssetValue.fromStringSync(`${chain}.${chain}`);
92
+ }
93
+ };
94
+
75
95
  export const isGasAsset = ({ chain, symbol }: { chain: Chain; symbol: string }) => {
76
96
  switch (chain) {
77
97
  case Chain.Arbitrum:
@@ -79,12 +99,8 @@ export const isGasAsset = ({ chain, symbol }: { chain: Chain; symbol: string })
79
99
  return symbol === "ETH";
80
100
  case Chain.Maya:
81
101
  return symbol === "CACAO";
82
- case Chain.Kujira:
83
- return symbol === "KUJI";
84
102
  case Chain.Cosmos:
85
103
  return symbol === "ATOM";
86
- case Chain.Polygon:
87
- return symbol === "MATIC";
88
104
  case Chain.BinanceSmartChain:
89
105
  return symbol === "BNB";
90
106
  case Chain.THORChain:
@@ -1,7 +1,7 @@
1
1
  import { Chain } from "../types/chains";
2
2
  import { MemoType } from "../types/sdk";
3
3
 
4
- export type ThornameRegisterParam = {
4
+ export type NameRegisterParam = {
5
5
  name: string;
6
6
  chain: string;
7
7
  address: string;
@@ -26,7 +26,7 @@ export type MemoOptions<T extends MemoType> = {
26
26
  targetAssetString?: string;
27
27
  singleSide?: boolean;
28
28
  }>;
29
- [MemoType.THORNAME_REGISTER]: Omit<ThornameRegisterParam, "preferredAsset" | "expiryBlock">;
29
+ [MemoType.NAME_REGISTER]: Omit<NameRegisterParam, "preferredAsset" | "expiryBlock">;
30
30
  }[T];
31
31
 
32
32
  export const getMemoFor = <T extends MemoType>(memoType: T, options: MemoOptions<T>) => {
@@ -42,8 +42,8 @@ export const getMemoFor = <T extends MemoType>(memoType: T, options: MemoOptions
42
42
  return `${memoType}:${address}:${unbondAmount}`;
43
43
  }
44
44
 
45
- case MemoType.THORNAME_REGISTER: {
46
- const { name, chain, address, owner } = options as MemoOptions<MemoType.THORNAME_REGISTER>;
45
+ case MemoType.NAME_REGISTER: {
46
+ const { name, chain, address, owner } = options as MemoOptions<MemoType.NAME_REGISTER>;
47
47
  return `${memoType}:${name}:${chain}:${address}${owner ? `:${owner}` : ""}`;
48
48
  }
49
49
 
@@ -53,6 +53,9 @@ const errorMessages = {
53
53
  core_transaction_invalid_sender_address: 10313,
54
54
  core_transaction_deposit_server_error: 10314,
55
55
  core_transaction_user_rejected: 10315,
56
+ core_transaction_create_liquidity_cacao_error: 10316,
57
+ core_transaction_add_liquidity_no_cacao_address: 10306,
58
+ core_transaction_add_liquidity_cacao_error: 10307,
56
59
 
57
60
  /**
58
61
  * Wallets
package/src/types/sdk.ts CHANGED
@@ -40,7 +40,7 @@ export enum MemoType {
40
40
  BOND = "BOND",
41
41
  DEPOSIT = "+",
42
42
  LEAVE = "LEAVE",
43
- THORNAME_REGISTER = "~",
43
+ NAME_REGISTER = "~",
44
44
  UNBOND = "UNBOND",
45
45
  WITHDRAW = "-",
46
46
  OPEN_LOAN = "$+",