@leather.io/constants 0.9.2 → 0.11.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @leather.io/constants@0.9.2 build /home/runner/work/mono/mono/packages/constants
2
+ > @leather.io/constants@0.11.0 build /home/runner/work/mono/mono/packages/constants
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,9 +8,9 @@ CLI tsup v8.1.0
8
8
  CLI Using tsup config: /home/runner/work/mono/mono/packages/constants/tsup.config.ts
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
- ESM dist/index.js 1.16 KB
12
- ESM dist/index.js.map 1.59 KB
13
- ESM ⚡️ Build success in 13ms
11
+ ESM dist/index.js 2.09 KB
12
+ ESM dist/index.js.map 3.48 KB
13
+ ESM ⚡️ Build success in 14ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 1467ms
16
- DTS dist/index.d.ts 1.21 KB
15
+ DTS ⚡️ Build success in 1127ms
16
+ DTS dist/index.d.ts 2.06 KB
package/CHANGELOG.md CHANGED
@@ -25,6 +25,35 @@
25
25
  * devDependencies
26
26
  * @leather.io/eslint-config bumped to 0.7.0
27
27
 
28
+ ## [0.11.0](https://github.com/leather-io/mono/compare/@leather.io/constants-v0.10.0...@leather.io/constants-v0.11.0) (2024-09-20)
29
+
30
+
31
+ ### Features
32
+
33
+ * settings account identifier, closes leather-io/issues[#205](https://github.com/leather-io/mono/issues/205) ([711c5a9](https://github.com/leather-io/mono/commit/711c5a96beff24130d82c733ebd8a111861c2efa))
34
+
35
+
36
+ ### Dependencies
37
+
38
+ * The following workspace dependencies were updated
39
+ * dependencies
40
+ * @leather.io/models bumped to 0.15.0
41
+
42
+ ## [0.10.0](https://github.com/leather-io/mono/compare/@leather.io/constants-v0.9.2...@leather.io/constants-v0.10.0) (2024-09-17)
43
+
44
+
45
+ ### Features
46
+
47
+ * settings bitcoin unit, closes leather-io/issues[#201](https://github.com/leather-io/mono/issues/201) ([bfe44f9](https://github.com/leather-io/mono/commit/bfe44f92ed31e342a69b63a3d20a7ef07fb5cb75))
48
+ * settings conversion unit, closes leather-io/issues[#200](https://github.com/leather-io/mono/issues/200) ([676683a](https://github.com/leather-io/mono/commit/676683a1a074f5ff2bd4b4f656ffb7c9c50d8a3f))
49
+
50
+
51
+ ### Dependencies
52
+
53
+ * The following workspace dependencies were updated
54
+ * dependencies
55
+ * @leather.io/models bumped to 0.14.0
56
+
28
57
  ## [0.9.2](https://github.com/leather-io/mono/compare/@leather.io/constants-v0.9.1...@leather.io/constants-v0.9.2) (2024-09-04)
29
58
 
30
59
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { BitcoinUnit, BitcoinUnitInfo, AccountDisplayPreference, AccountDisplayPreferenceInfo } from '@leather.io/models';
2
+
1
3
  declare const gaiaUrl = "https://hub.blockstack.org";
2
4
  declare const ZERO_INDEX = 0;
3
5
  declare const HIRO_EXPLORER_URL = "https://explorer.hiro.so";
@@ -13,11 +15,30 @@ declare const currencyDecimalsMap: {
13
15
  readonly BTC: 8;
14
16
  readonly STX: 6;
15
17
  readonly USD: 2;
18
+ readonly EUR: 2;
19
+ readonly GBP: 2;
20
+ readonly AUD: 2;
21
+ readonly CAD: 2;
22
+ readonly CNY: 2;
23
+ readonly JPY: 0;
24
+ readonly KRW: 0;
25
+ };
26
+ declare const currencyNameMap: {
27
+ readonly USD: "united states dollar";
28
+ readonly EUR: "euro";
29
+ readonly GBP: "british pound";
30
+ readonly AUD: "australian dollar";
31
+ readonly CAD: "canadian dollar";
32
+ readonly CNY: "chinese yuan";
33
+ readonly JPY: "japanese yen";
34
+ readonly KRW: "south korean won";
16
35
  };
17
36
  declare const BTC_P2WPKH_DUST_AMOUNT = 294;
18
37
  declare const KEBAB_REGEX: RegExp;
19
38
  declare const DEFAULT_LIST_LIMIT = 50;
20
39
  declare const TOKEN_NAME_LENGTH = 4;
21
40
  declare const LEATHER_SUPPORT_URL = "https://leather.io/contact";
41
+ declare const bitcoinUnitsKeyedByName: Record<BitcoinUnit, BitcoinUnitInfo>;
42
+ declare const accountDisplayPreferencesKeyedByType: Record<AccountDisplayPreference, AccountDisplayPreferenceInfo>;
22
43
 
23
- export { BTC_DECIMALS, BTC_P2WPKH_DUST_AMOUNT, DEFAULT_FEE_RATE, DEFAULT_LIST_LIMIT, HIGH_FEE_AMOUNT_STX, HIGH_FEE_WARNING_LEARN_MORE_URL_BTC, HIGH_FEE_WARNING_LEARN_MORE_URL_STX, HIRO_EXPLORER_URL, KEBAB_REGEX, LEATHER_SUPPORT_URL, ORD_IO_URL, PERSISTENCE_CACHE_TIME, STX_DECIMALS, TOKEN_NAME_LENGTH, ZERO_INDEX, currencyDecimalsMap, gaiaUrl };
44
+ export { BTC_DECIMALS, BTC_P2WPKH_DUST_AMOUNT, DEFAULT_FEE_RATE, DEFAULT_LIST_LIMIT, HIGH_FEE_AMOUNT_STX, HIGH_FEE_WARNING_LEARN_MORE_URL_BTC, HIGH_FEE_WARNING_LEARN_MORE_URL_STX, HIRO_EXPLORER_URL, KEBAB_REGEX, LEATHER_SUPPORT_URL, ORD_IO_URL, PERSISTENCE_CACHE_TIME, STX_DECIMALS, TOKEN_NAME_LENGTH, ZERO_INDEX, accountDisplayPreferencesKeyedByType, bitcoinUnitsKeyedByName, currencyDecimalsMap, currencyNameMap, gaiaUrl };
package/dist/index.js CHANGED
@@ -13,13 +13,64 @@ var STX_DECIMALS = 6;
13
13
  var currencyDecimalsMap = {
14
14
  BTC: BTC_DECIMALS,
15
15
  STX: STX_DECIMALS,
16
- USD: 2
16
+ USD: 2,
17
+ EUR: 2,
18
+ GBP: 2,
19
+ AUD: 2,
20
+ CAD: 2,
21
+ CNY: 2,
22
+ JPY: 0,
23
+ KRW: 0
24
+ };
25
+ var currencyNameMap = {
26
+ USD: "united states dollar",
27
+ EUR: "euro",
28
+ GBP: "british pound",
29
+ AUD: "australian dollar",
30
+ CAD: "canadian dollar",
31
+ CNY: "chinese yuan",
32
+ JPY: "japanese yen",
33
+ KRW: "south korean won"
17
34
  };
18
35
  var BTC_P2WPKH_DUST_AMOUNT = 294;
19
36
  var KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;
20
37
  var DEFAULT_LIST_LIMIT = 50;
21
38
  var TOKEN_NAME_LENGTH = 4;
22
39
  var LEATHER_SUPPORT_URL = "https://leather.io/contact";
40
+ var bitcoinUnitsKeyedByName = {
41
+ bitcoin: {
42
+ name: "bitcoin",
43
+ symbol: "BTC",
44
+ decimal: "1"
45
+ },
46
+ satoshi: {
47
+ name: "satoshi",
48
+ symbol: "sat",
49
+ decimal: "0.00000001"
50
+ }
51
+ };
52
+ var accountDisplayPreferencesKeyedByType = {
53
+ ns: {
54
+ type: "ns",
55
+ blockchain: "bitcoin",
56
+ name: "Native SegWit"
57
+ },
58
+ tr: {
59
+ type: "tr",
60
+ blockchain: "bitcoin",
61
+ name: "Taproot address"
62
+ },
63
+ bns: {
64
+ type: "bns",
65
+ blockchain: "stacks",
66
+ name: "BNS name"
67
+ },
68
+ stacks: {
69
+ type: "stacks",
70
+ blockchain: "stacks",
71
+ name: "Stacks address"
72
+ }
73
+ };
23
74
  export {
24
75
  BTC_DECIMALS,
25
76
  BTC_P2WPKH_DUST_AMOUNT,
@@ -36,7 +87,10 @@ export {
36
87
  STX_DECIMALS,
37
88
  TOKEN_NAME_LENGTH,
38
89
  ZERO_INDEX,
90
+ accountDisplayPreferencesKeyedByType,
91
+ bitcoinUnitsKeyedByName,
39
92
  currencyDecimalsMap,
93
+ currencyNameMap,
40
94
  gaiaUrl
41
95
  };
42
96
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const gaiaUrl = 'https://hub.blockstack.org';\n\nexport const ZERO_INDEX = 0;\n\nexport const HIRO_EXPLORER_URL = 'https://explorer.hiro.so';\nexport const ORD_IO_URL = 'https://ord.io';\n\nexport const HIGH_FEE_AMOUNT_STX = 5;\nexport const HIGH_FEE_WARNING_LEARN_MORE_URL_BTC = 'https://bitcoinfees.earn.com/';\nexport const HIGH_FEE_WARNING_LEARN_MORE_URL_STX =\n 'https://leather.gitbook.io/guides/transactions/fees';\n\nexport const DEFAULT_FEE_RATE = 400;\n\nexport const PERSISTENCE_CACHE_TIME = 1000 * 60 * 60 * 12; // 12 hours\n\nexport const BTC_DECIMALS = 8;\nexport const STX_DECIMALS = 6;\n\n// Units of `Money` should be declared in their smallest unit. Similar to\n// Rosetta, we model currencies with their respective resolution\nexport const currencyDecimalsMap = {\n BTC: BTC_DECIMALS,\n STX: STX_DECIMALS,\n USD: 2,\n} as const;\n\n// https://bitcoin.stackexchange.com/a/41082/139277\nexport const BTC_P2WPKH_DUST_AMOUNT = 294;\n\nexport const KEBAB_REGEX = /[A-Z\\u00C0-\\u00D6\\u00D8-\\u00DE]/g;\n\nexport const DEFAULT_LIST_LIMIT = 50;\n\nexport const TOKEN_NAME_LENGTH = 4;\n\nexport const LEATHER_SUPPORT_URL = 'https://leather.io/contact';\n"],"mappings":";AAAO,IAAM,UAAU;AAEhB,IAAM,aAAa;AAEnB,IAAM,oBAAoB;AAC1B,IAAM,aAAa;AAEnB,IAAM,sBAAsB;AAC5B,IAAM,sCAAsC;AAC5C,IAAM,sCACX;AAEK,IAAM,mBAAmB;AAEzB,IAAM,yBAAyB,MAAO,KAAK,KAAK;AAEhD,IAAM,eAAe;AACrB,IAAM,eAAe;AAIrB,IAAM,sBAAsB;AAAA,EACjC,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAGO,IAAM,yBAAyB;AAE/B,IAAM,cAAc;AAEpB,IAAM,qBAAqB;AAE3B,IAAM,oBAAoB;AAE1B,IAAM,sBAAsB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n AccountDisplayPreference,\n AccountDisplayPreferenceInfo,\n BitcoinUnit,\n BitcoinUnitInfo,\n} from '@leather.io/models';\n\nexport const gaiaUrl = 'https://hub.blockstack.org';\n\nexport const ZERO_INDEX = 0;\n\nexport const HIRO_EXPLORER_URL = 'https://explorer.hiro.so';\nexport const ORD_IO_URL = 'https://ord.io';\n\nexport const HIGH_FEE_AMOUNT_STX = 5;\nexport const HIGH_FEE_WARNING_LEARN_MORE_URL_BTC = 'https://bitcoinfees.earn.com/';\nexport const HIGH_FEE_WARNING_LEARN_MORE_URL_STX =\n 'https://leather.gitbook.io/guides/transactions/fees';\n\nexport const DEFAULT_FEE_RATE = 400;\n\nexport const PERSISTENCE_CACHE_TIME = 1000 * 60 * 60 * 12; // 12 hours\n\nexport const BTC_DECIMALS = 8;\nexport const STX_DECIMALS = 6;\n\n// Units of `Money` should be declared in their smallest unit. Similar to\n// Rosetta, we model currencies with their respective resolution\nexport const currencyDecimalsMap = {\n BTC: BTC_DECIMALS,\n STX: STX_DECIMALS,\n USD: 2,\n EUR: 2,\n GBP: 2,\n AUD: 2,\n CAD: 2,\n CNY: 2,\n JPY: 0,\n KRW: 0,\n} as const;\n\nexport const currencyNameMap = {\n USD: 'united states dollar',\n EUR: 'euro',\n GBP: 'british pound',\n AUD: 'australian dollar',\n CAD: 'canadian dollar',\n CNY: 'chinese yuan',\n JPY: 'japanese yen',\n KRW: 'south korean won',\n} as const;\n\n// https://bitcoin.stackexchange.com/a/41082/139277\nexport const BTC_P2WPKH_DUST_AMOUNT = 294;\n\nexport const KEBAB_REGEX = /[A-Z\\u00C0-\\u00D6\\u00D8-\\u00DE]/g;\n\nexport const DEFAULT_LIST_LIMIT = 50;\n\nexport const TOKEN_NAME_LENGTH = 4;\n\nexport const LEATHER_SUPPORT_URL = 'https://leather.io/contact';\n\nexport const bitcoinUnitsKeyedByName: Record<BitcoinUnit, BitcoinUnitInfo> = {\n bitcoin: {\n name: 'bitcoin',\n symbol: 'BTC',\n decimal: '1',\n },\n satoshi: {\n name: 'satoshi',\n symbol: 'sat',\n decimal: '0.00000001',\n },\n};\n\nexport const accountDisplayPreferencesKeyedByType: Record<\n AccountDisplayPreference,\n AccountDisplayPreferenceInfo\n> = {\n ns: {\n type: 'ns',\n blockchain: 'bitcoin',\n name: 'Native SegWit',\n },\n tr: {\n type: 'tr',\n blockchain: 'bitcoin',\n name: 'Taproot address',\n },\n bns: {\n type: 'bns',\n blockchain: 'stacks',\n name: 'BNS name',\n },\n stacks: {\n type: 'stacks',\n blockchain: 'stacks',\n name: 'Stacks address',\n },\n};\n"],"mappings":";AAOO,IAAM,UAAU;AAEhB,IAAM,aAAa;AAEnB,IAAM,oBAAoB;AAC1B,IAAM,aAAa;AAEnB,IAAM,sBAAsB;AAC5B,IAAM,sCAAsC;AAC5C,IAAM,sCACX;AAEK,IAAM,mBAAmB;AAEzB,IAAM,yBAAyB,MAAO,KAAK,KAAK;AAEhD,IAAM,eAAe;AACrB,IAAM,eAAe;AAIrB,IAAM,sBAAsB;AAAA,EACjC,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEO,IAAM,kBAAkB;AAAA,EAC7B,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAGO,IAAM,yBAAyB;AAE/B,IAAM,cAAc;AAEpB,IAAM,qBAAqB;AAE3B,IAAM,oBAAoB;AAE1B,IAAM,sBAAsB;AAE5B,IAAM,0BAAgE;AAAA,EAC3E,SAAS;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,SAAS;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACF;AAEO,IAAM,uCAGT;AAAA,EACF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,MAAM;AAAA,EACR;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,MAAM;AAAA,EACR;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,MAAM;AAAA,EACR;AACF;","names":[]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@leather.io/constants",
3
3
  "author": "Leather.io contact@leather.io",
4
4
  "description": "Shared bitcoin utilities",
5
- "version": "0.9.2",
5
+ "version": "0.11.0",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/leather-io/mono/tree/dev/packages/constants",
8
8
  "repository": {
@@ -15,6 +15,9 @@
15
15
  ".": "./dist/index.js"
16
16
  },
17
17
  "bugs": "https://github.com/leather-io/mono/issues",
18
+ "dependencies": {
19
+ "@leather.io/models": "0.15.0"
20
+ },
18
21
  "devDependencies": {
19
22
  "concurrently": "8.2.2",
20
23
  "eslint": "8.53.0",
@@ -22,8 +25,8 @@
22
25
  "tsup": "8.1.0",
23
26
  "typescript": "5.5.4",
24
27
  "@leather.io/eslint-config": "0.7.0",
25
- "@leather.io/tsconfig-config": "0.6.0",
26
- "@leather.io/prettier-config": "0.6.0"
28
+ "@leather.io/prettier-config": "0.6.0",
29
+ "@leather.io/tsconfig-config": "0.6.0"
27
30
  },
28
31
  "keywords": [
29
32
  "constants",
package/src/index.ts CHANGED
@@ -1,3 +1,10 @@
1
+ import type {
2
+ AccountDisplayPreference,
3
+ AccountDisplayPreferenceInfo,
4
+ BitcoinUnit,
5
+ BitcoinUnitInfo,
6
+ } from '@leather.io/models';
7
+
1
8
  export const gaiaUrl = 'https://hub.blockstack.org';
2
9
 
3
10
  export const ZERO_INDEX = 0;
@@ -23,6 +30,24 @@ export const currencyDecimalsMap = {
23
30
  BTC: BTC_DECIMALS,
24
31
  STX: STX_DECIMALS,
25
32
  USD: 2,
33
+ EUR: 2,
34
+ GBP: 2,
35
+ AUD: 2,
36
+ CAD: 2,
37
+ CNY: 2,
38
+ JPY: 0,
39
+ KRW: 0,
40
+ } as const;
41
+
42
+ export const currencyNameMap = {
43
+ USD: 'united states dollar',
44
+ EUR: 'euro',
45
+ GBP: 'british pound',
46
+ AUD: 'australian dollar',
47
+ CAD: 'canadian dollar',
48
+ CNY: 'chinese yuan',
49
+ JPY: 'japanese yen',
50
+ KRW: 'south korean won',
26
51
  } as const;
27
52
 
28
53
  // https://bitcoin.stackexchange.com/a/41082/139277
@@ -35,3 +60,42 @@ export const DEFAULT_LIST_LIMIT = 50;
35
60
  export const TOKEN_NAME_LENGTH = 4;
36
61
 
37
62
  export const LEATHER_SUPPORT_URL = 'https://leather.io/contact';
63
+
64
+ export const bitcoinUnitsKeyedByName: Record<BitcoinUnit, BitcoinUnitInfo> = {
65
+ bitcoin: {
66
+ name: 'bitcoin',
67
+ symbol: 'BTC',
68
+ decimal: '1',
69
+ },
70
+ satoshi: {
71
+ name: 'satoshi',
72
+ symbol: 'sat',
73
+ decimal: '0.00000001',
74
+ },
75
+ };
76
+
77
+ export const accountDisplayPreferencesKeyedByType: Record<
78
+ AccountDisplayPreference,
79
+ AccountDisplayPreferenceInfo
80
+ > = {
81
+ ns: {
82
+ type: 'ns',
83
+ blockchain: 'bitcoin',
84
+ name: 'Native SegWit',
85
+ },
86
+ tr: {
87
+ type: 'tr',
88
+ blockchain: 'bitcoin',
89
+ name: 'Taproot address',
90
+ },
91
+ bns: {
92
+ type: 'bns',
93
+ blockchain: 'stacks',
94
+ name: 'BNS name',
95
+ },
96
+ stacks: {
97
+ type: 'stacks',
98
+ blockchain: 'stacks',
99
+ name: 'Stacks address',
100
+ },
101
+ };