stackswap-front-api-test-02 1.0.84 → 1.0.85

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.
Files changed (87) hide show
  1. package/README.md +10 -10
  2. package/dist/esm/index.d.ts +84 -84
  3. package/dist/esm/index.js +143 -143
  4. package/dist/esm/stackswap/config.d.ts +112 -112
  5. package/dist/esm/stackswap/config.js +185 -185
  6. package/dist/esm/stackswap/manager/farm.manager.d.ts +41 -41
  7. package/dist/esm/stackswap/manager/farm.manager.js +293 -293
  8. package/dist/esm/stackswap/manager/farm2.manager.d.ts +60 -60
  9. package/dist/esm/stackswap/manager/farm2.manager.js +403 -403
  10. package/dist/esm/stackswap/manager/governance.manager.d.ts +9 -9
  11. package/dist/esm/stackswap/manager/governance.manager.js +53 -53
  12. package/dist/esm/stackswap/manager/launchpad.manager.d.ts +13 -13
  13. package/dist/esm/stackswap/manager/launchpad.manager.js +147 -147
  14. package/dist/esm/stackswap/manager/lbtc.manager.d.ts +31 -31
  15. package/dist/esm/stackswap/manager/lbtc.manager.js +326 -326
  16. package/dist/esm/stackswap/manager/multisig.manager.d.ts +11 -11
  17. package/dist/esm/stackswap/manager/multisig.manager.js +51 -51
  18. package/dist/esm/stackswap/manager/nft.manager.d.ts +52 -52
  19. package/dist/esm/stackswap/manager/nft.manager.js +243 -243
  20. package/dist/esm/stackswap/manager/operator.manager.d.ts +17 -17
  21. package/dist/esm/stackswap/manager/operator.manager.js +85 -85
  22. package/dist/esm/stackswap/manager/other.manager.d.ts +9 -9
  23. package/dist/esm/stackswap/manager/other.manager.js +47 -47
  24. package/dist/esm/stackswap/manager/pool.manager.d.ts +34 -34
  25. package/dist/esm/stackswap/manager/pool.manager.js +171 -171
  26. package/dist/esm/stackswap/manager/poxl.manager.d.ts +16 -16
  27. package/dist/esm/stackswap/manager/poxl.manager.js +71 -71
  28. package/dist/esm/stackswap/manager/staking.manager.d.ts +25 -25
  29. package/dist/esm/stackswap/manager/staking.manager.js +233 -233
  30. package/dist/esm/stackswap/manager/swap.manager.d.ts +35 -35
  31. package/dist/esm/stackswap/manager/swap.manager.js +290 -290
  32. package/dist/esm/stackswap/manager/token.manager.d.ts +31 -31
  33. package/dist/esm/stackswap/manager/token.manager.js +133 -133
  34. package/dist/esm/stackswap/util.d.ts +35 -35
  35. package/dist/esm/stackswap/util.js +201 -201
  36. package/dist/index.d.ts +84 -84
  37. package/dist/index.js +152 -152
  38. package/dist/index.umd.js +1 -1
  39. package/dist/stackswap/config.d.ts +112 -112
  40. package/dist/stackswap/config.js +190 -190
  41. package/dist/stackswap/manager/farm.manager.d.ts +41 -41
  42. package/dist/stackswap/manager/farm.manager.js +301 -301
  43. package/dist/stackswap/manager/farm2.manager.d.ts +60 -60
  44. package/dist/stackswap/manager/farm2.manager.js +410 -410
  45. package/dist/stackswap/manager/governance.manager.d.ts +9 -9
  46. package/dist/stackswap/manager/governance.manager.js +60 -60
  47. package/dist/stackswap/manager/launchpad.manager.d.ts +13 -13
  48. package/dist/stackswap/manager/launchpad.manager.js +151 -151
  49. package/dist/stackswap/manager/lbtc.manager.d.ts +31 -31
  50. package/dist/stackswap/manager/lbtc.manager.js +333 -333
  51. package/dist/stackswap/manager/multisig.manager.d.ts +11 -11
  52. package/dist/stackswap/manager/multisig.manager.js +55 -55
  53. package/dist/stackswap/manager/nft.manager.d.ts +52 -52
  54. package/dist/stackswap/manager/nft.manager.js +250 -250
  55. package/dist/stackswap/manager/operator.manager.d.ts +17 -17
  56. package/dist/stackswap/manager/operator.manager.js +92 -92
  57. package/dist/stackswap/manager/other.manager.d.ts +9 -9
  58. package/dist/stackswap/manager/other.manager.js +54 -54
  59. package/dist/stackswap/manager/pool.manager.d.ts +34 -34
  60. package/dist/stackswap/manager/pool.manager.js +179 -179
  61. package/dist/stackswap/manager/poxl.manager.d.ts +16 -16
  62. package/dist/stackswap/manager/poxl.manager.js +78 -78
  63. package/dist/stackswap/manager/staking.manager.d.ts +25 -25
  64. package/dist/stackswap/manager/staking.manager.js +240 -240
  65. package/dist/stackswap/manager/swap.manager.d.ts +35 -35
  66. package/dist/stackswap/manager/swap.manager.js +297 -297
  67. package/dist/stackswap/manager/token.manager.d.ts +31 -31
  68. package/dist/stackswap/manager/token.manager.js +141 -141
  69. package/dist/stackswap/util.d.ts +35 -35
  70. package/dist/stackswap/util.js +218 -218
  71. package/package.json +43 -43
  72. package/src/index.ts +204 -204
  73. package/src/stackswap/config.ts +292 -292
  74. package/src/stackswap/manager/farm.manager.ts +399 -399
  75. package/src/stackswap/manager/farm2.manager.ts +463 -463
  76. package/src/stackswap/manager/governance.manager.ts +95 -95
  77. package/src/stackswap/manager/launchpad.manager.ts +190 -190
  78. package/src/stackswap/manager/multisig.manager.ts +87 -87
  79. package/src/stackswap/manager/nft.manager.ts +311 -311
  80. package/src/stackswap/manager/operator.manager.ts +123 -123
  81. package/src/stackswap/manager/other.manager.ts +71 -71
  82. package/src/stackswap/manager/pool.manager.ts +202 -202
  83. package/src/stackswap/manager/poxl.manager.ts +99 -99
  84. package/src/stackswap/manager/staking.manager.ts +321 -321
  85. package/src/stackswap/manager/swap.manager.ts +351 -351
  86. package/src/stackswap/manager/token.manager.ts +167 -167
  87. package/src/stackswap/util.ts +237 -237
@@ -1,219 +1,219 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getAmountStringWithDecimal = exports.getAmountWithDecimalString = exports.getPriceAndDY = exports.numFormat_ = exports.numWithComma = exports.decimal2integer = exports.num2decimal = exports.getPostConditionFromAsset = exports.getWriteOptions = exports.getReadOptions = exports.parseAddressToCV = void 0;
7
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
- const transactions_1 = require("@stacks/transactions");
9
- const axios_1 = __importDefault(require("axios"));
10
- function parseAddressToCV(addr) {
11
- if (addr.includes('.')) {
12
- const [address, contractName] = addr.split('.');
13
- return (0, transactions_1.contractPrincipalCV)(address, contractName);
14
- }
15
- else {
16
- return (0, transactions_1.standardPrincipalCV)(addr);
17
- }
18
- }
19
- exports.parseAddressToCV = parseAddressToCV;
20
- function getReadOptions(stackswap, contractName, functionName, functionArgs) {
21
- if (contractName.includes('.')) {
22
- const parsedAddress = contractName.split('.');
23
- return {
24
- contractAddress: parsedAddress[0],
25
- contractName: parsedAddress[1],
26
- functionName,
27
- functionArgs,
28
- network: stackswap.network,
29
- senderAddress: stackswap.getSenderAddress(),
30
- };
31
- }
32
- else {
33
- return {
34
- contractAddress: stackswap.config.STACKSWAP_ADDRESS(),
35
- contractName,
36
- functionName,
37
- functionArgs,
38
- network: stackswap.network,
39
- senderAddress: stackswap.getSenderAddress(),
40
- };
41
- }
42
- }
43
- exports.getReadOptions = getReadOptions;
44
- function getWriteOptions(stackswap, contractName, functionName, functionArgs, postConditions = [], callback = null, conditionMode = false) {
45
- if (contractName.includes('.')) {
46
- const parsedAddress = contractName.split('.');
47
- return {
48
- contractAddress: parsedAddress[0],
49
- contractName: parsedAddress[1],
50
- functionName,
51
- functionArgs,
52
- network: stackswap.network,
53
- senderAddress: stackswap.getSenderAddress(),
54
- postConditionMode: conditionMode ? transactions_1.PostConditionMode.Allow : transactions_1.PostConditionMode.Deny,
55
- postConditions,
56
- appDetails: {
57
- name: 'Stackswap',
58
- icon: window.location.origin + '/public/favicon.ico',
59
- },
60
- anchorMode: transactions_1.AnchorMode.Any,
61
- sponsored: false,
62
- onFinish: (data) => {
63
- try {
64
- callback(null, data);
65
- }
66
- catch (e) {
67
- callback(e, null);
68
- }
69
- },
70
- onCancel: () => {
71
- try {
72
- callback('canceled', null);
73
- }
74
- catch (e) {
75
- callback(e, null);
76
- }
77
- },
78
- };
79
- }
80
- else {
81
- return {
82
- contractAddress: stackswap.config.STACKSWAP_ADDRESS(),
83
- contractName,
84
- functionName,
85
- functionArgs,
86
- network: stackswap.network,
87
- senderAddress: stackswap.getSenderAddress(),
88
- postConditionMode: conditionMode ? transactions_1.PostConditionMode.Allow : transactions_1.PostConditionMode.Deny,
89
- postConditions,
90
- appDetails: {
91
- name: 'Stackswap',
92
- icon: window.location.origin + '/public/favicon.ico',
93
- },
94
- anchorMode: transactions_1.AnchorMode.Any,
95
- sponsored: false,
96
- onFinish: (data) => {
97
- try {
98
- callback(null, data);
99
- }
100
- catch (e) {
101
- callback(e, null);
102
- }
103
- },
104
- onCancel: () => {
105
- try {
106
- callback('canceled', null);
107
- }
108
- catch (e) {
109
- callback(e, null);
110
- }
111
- },
112
- };
113
- }
114
- }
115
- exports.getWriteOptions = getWriteOptions;
116
- async function getFTAsset(stackswap, tokenStr) {
117
- const token_addr = tokenStr.split('.');
118
- const url = stackswap.config.STACKS_API_URL() + '/v2/contracts/interface/' + token_addr[0] + '/' + token_addr[1];
119
- const result = await axios_1.default.get(url);
120
- if (result.data.fungible_tokens.length === 1) {
121
- return tokenStr + '::' + result.data.fungible_tokens[0].name;
122
- }
123
- else if (result.data.fungible_tokens.length === 0) {
124
- return 'wstx';
125
- }
126
- else {
127
- return tokenStr + '::' + result.data.fungible_tokens[0].name;
128
- }
129
- }
130
- async function getPostConditionFromAsset(stackswap, account, tokenStr, tokenAmount, condition) {
131
- const assetString = await getFTAsset(stackswap, tokenStr);
132
- if (assetString === 'wstx') {
133
- return (0, transactions_1.createSTXPostCondition)(account, condition, tokenAmount);
134
- }
135
- else {
136
- return (0, transactions_1.createFungiblePostCondition)(account, condition, tokenAmount, assetString);
137
- }
138
- }
139
- exports.getPostConditionFromAsset = getPostConditionFromAsset;
140
- function num2decimal(input, decimal) {
141
- return (new bignumber_js_1.default(input)).dividedBy(10 ** decimal);
142
- }
143
- exports.num2decimal = num2decimal;
144
- function decimal2integer(input, decimal = 6) {
145
- return (new bignumber_js_1.default(input)).multipliedBy(10 ** decimal).toFixed(0);
146
- }
147
- exports.decimal2integer = decimal2integer;
148
- function numWithComma(input) {
149
- if (typeof (input) === 'string') {
150
- return new bignumber_js_1.default(input).toNumber().toLocaleString();
151
- }
152
- else if (typeof (input) === 'number') {
153
- return new bignumber_js_1.default(input).toNumber().toLocaleString();
154
- }
155
- else if (bignumber_js_1.default.isBigNumber(input)) {
156
- return input.toNumber().toLocaleString();
157
- }
158
- else {
159
- return 'ERROR';
160
- }
161
- }
162
- exports.numWithComma = numWithComma;
163
- function numFormat_(input, decimal = 6) {
164
- const input_bn = new bignumber_js_1.default(input);
165
- if (input_bn.isInteger()) {
166
- return numWithComma(input_bn);
167
- }
168
- else {
169
- return numWithComma(input_bn.toFixed(decimal, 1));
170
- }
171
- }
172
- exports.numFormat_ = numFormat_;
173
- function getPriceAndDY(pair, amount = '-1', x_to_y = true) {
174
- try {
175
- const balance_x = x_to_y ? pair.balance_x : pair.balance_y;
176
- const balance_y = x_to_y ? pair.balance_y : pair.balance_x;
177
- const decimal_x = x_to_y ? pair.token_x.decimal : pair.token_y.decimal;
178
- const decimal_y = x_to_y ? pair.token_y.decimal : pair.token_x.decimal;
179
- let dx2 = new bignumber_js_1.default(10).exponentiatedBy(decimal_x).multipliedBy(amount).multipliedBy(0.997);
180
- if (amount == '-1') {
181
- dx2 = new bignumber_js_1.default(1);
182
- }
183
- if (dx2.comparedTo(balance_x) >= 0) {
184
- return { dy: '0', output_price: '0' };
185
- }
186
- const dy2 = (new bignumber_js_1.default(balance_y).multipliedBy(dx2)).dividedBy(new bignumber_js_1.default(balance_x).plus(dx2));
187
- const output_price2 = ((new bignumber_js_1.default(10).exponentiatedBy(decimal_y)).dividedBy(new bignumber_js_1.default(10).exponentiatedBy(decimal_x))).toNumber() * ((dx2).toNumber() / (dy2).toNumber());
188
- const output_price_final = output_price2.toString();
189
- const dy_final = dy2.dividedBy(new bignumber_js_1.default(10).exponentiatedBy(decimal_y)).toString();
190
- if (amount == '-1') {
191
- return { dy: '0', output_price: output_price_final };
192
- }
193
- return { dy: dy_final, output_price: output_price_final };
194
- }
195
- catch (e) {
196
- return { dy: '0', output_price: '0' };
197
- }
198
- }
199
- exports.getPriceAndDY = getPriceAndDY;
200
- function getAmountWithDecimalString(amount, decimal) {
201
- bignumber_js_1.default.config({ EXPONENTIAL_AT: 40 });
202
- try {
203
- return new bignumber_js_1.default(10 ** decimal).multipliedBy(amount).toString();
204
- }
205
- catch (e) {
206
- return new bignumber_js_1.default(10 ** decimal).multipliedBy(new bignumber_js_1.default(amount)).toString();
207
- }
208
- }
209
- exports.getAmountWithDecimalString = getAmountWithDecimalString;
210
- function getAmountStringWithDecimal(amount, decimal) {
211
- try {
212
- return new bignumber_js_1.default(10 ** decimal).multipliedBy(amount).toString();
213
- }
214
- catch (e) {
215
- return new bignumber_js_1.default(10 ** decimal).multipliedBy(new bignumber_js_1.default(amount)).toString();
216
- }
217
- }
218
- exports.getAmountStringWithDecimal = getAmountStringWithDecimal;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAmountStringWithDecimal = exports.getAmountWithDecimalString = exports.getPriceAndDY = exports.numFormat_ = exports.numWithComma = exports.decimal2integer = exports.num2decimal = exports.getPostConditionFromAsset = exports.getWriteOptions = exports.getReadOptions = exports.parseAddressToCV = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const transactions_1 = require("@stacks/transactions");
9
+ const axios_1 = __importDefault(require("axios"));
10
+ function parseAddressToCV(addr) {
11
+ if (addr.includes('.')) {
12
+ const [address, contractName] = addr.split('.');
13
+ return (0, transactions_1.contractPrincipalCV)(address, contractName);
14
+ }
15
+ else {
16
+ return (0, transactions_1.standardPrincipalCV)(addr);
17
+ }
18
+ }
19
+ exports.parseAddressToCV = parseAddressToCV;
20
+ function getReadOptions(stackswap, contractName, functionName, functionArgs) {
21
+ if (contractName.includes('.')) {
22
+ const parsedAddress = contractName.split('.');
23
+ return {
24
+ contractAddress: parsedAddress[0],
25
+ contractName: parsedAddress[1],
26
+ functionName,
27
+ functionArgs,
28
+ network: stackswap.network,
29
+ senderAddress: stackswap.getSenderAddress(),
30
+ };
31
+ }
32
+ else {
33
+ return {
34
+ contractAddress: stackswap.config.STACKSWAP_ADDRESS(),
35
+ contractName,
36
+ functionName,
37
+ functionArgs,
38
+ network: stackswap.network,
39
+ senderAddress: stackswap.getSenderAddress(),
40
+ };
41
+ }
42
+ }
43
+ exports.getReadOptions = getReadOptions;
44
+ function getWriteOptions(stackswap, contractName, functionName, functionArgs, postConditions = [], callback = null, conditionMode = false) {
45
+ if (contractName.includes('.')) {
46
+ const parsedAddress = contractName.split('.');
47
+ return {
48
+ contractAddress: parsedAddress[0],
49
+ contractName: parsedAddress[1],
50
+ functionName,
51
+ functionArgs,
52
+ network: stackswap.network,
53
+ senderAddress: stackswap.getSenderAddress(),
54
+ postConditionMode: conditionMode ? transactions_1.PostConditionMode.Allow : transactions_1.PostConditionMode.Deny,
55
+ postConditions,
56
+ appDetails: {
57
+ name: 'Stackswap',
58
+ icon: window.location.origin + '/public/favicon.ico',
59
+ },
60
+ anchorMode: transactions_1.AnchorMode.Any,
61
+ sponsored: false,
62
+ onFinish: (data) => {
63
+ try {
64
+ callback(null, data);
65
+ }
66
+ catch (e) {
67
+ callback(e, null);
68
+ }
69
+ },
70
+ onCancel: () => {
71
+ try {
72
+ callback('canceled', null);
73
+ }
74
+ catch (e) {
75
+ callback(e, null);
76
+ }
77
+ },
78
+ };
79
+ }
80
+ else {
81
+ return {
82
+ contractAddress: stackswap.config.STACKSWAP_ADDRESS(),
83
+ contractName,
84
+ functionName,
85
+ functionArgs,
86
+ network: stackswap.network,
87
+ senderAddress: stackswap.getSenderAddress(),
88
+ postConditionMode: conditionMode ? transactions_1.PostConditionMode.Allow : transactions_1.PostConditionMode.Deny,
89
+ postConditions,
90
+ appDetails: {
91
+ name: 'Stackswap',
92
+ icon: window.location.origin + '/public/favicon.ico',
93
+ },
94
+ anchorMode: transactions_1.AnchorMode.Any,
95
+ sponsored: false,
96
+ onFinish: (data) => {
97
+ try {
98
+ callback(null, data);
99
+ }
100
+ catch (e) {
101
+ callback(e, null);
102
+ }
103
+ },
104
+ onCancel: () => {
105
+ try {
106
+ callback('canceled', null);
107
+ }
108
+ catch (e) {
109
+ callback(e, null);
110
+ }
111
+ },
112
+ };
113
+ }
114
+ }
115
+ exports.getWriteOptions = getWriteOptions;
116
+ async function getFTAsset(stackswap, tokenStr) {
117
+ const token_addr = tokenStr.split('.');
118
+ const url = stackswap.config.STACKS_API_URL() + '/v2/contracts/interface/' + token_addr[0] + '/' + token_addr[1];
119
+ const result = await axios_1.default.get(url);
120
+ if (result.data.fungible_tokens.length === 1) {
121
+ return tokenStr + '::' + result.data.fungible_tokens[0].name;
122
+ }
123
+ else if (result.data.fungible_tokens.length === 0) {
124
+ return 'wstx';
125
+ }
126
+ else {
127
+ return tokenStr + '::' + result.data.fungible_tokens[0].name;
128
+ }
129
+ }
130
+ async function getPostConditionFromAsset(stackswap, account, tokenStr, tokenAmount, condition) {
131
+ const assetString = await getFTAsset(stackswap, tokenStr);
132
+ if (assetString === 'wstx') {
133
+ return (0, transactions_1.createSTXPostCondition)(account, condition, tokenAmount);
134
+ }
135
+ else {
136
+ return (0, transactions_1.createFungiblePostCondition)(account, condition, tokenAmount, assetString);
137
+ }
138
+ }
139
+ exports.getPostConditionFromAsset = getPostConditionFromAsset;
140
+ function num2decimal(input, decimal) {
141
+ return (new bignumber_js_1.default(input)).dividedBy(10 ** decimal);
142
+ }
143
+ exports.num2decimal = num2decimal;
144
+ function decimal2integer(input, decimal = 6) {
145
+ return (new bignumber_js_1.default(input)).multipliedBy(10 ** decimal).toFixed(0);
146
+ }
147
+ exports.decimal2integer = decimal2integer;
148
+ function numWithComma(input) {
149
+ if (typeof (input) === 'string') {
150
+ return new bignumber_js_1.default(input).toNumber().toLocaleString();
151
+ }
152
+ else if (typeof (input) === 'number') {
153
+ return new bignumber_js_1.default(input).toNumber().toLocaleString();
154
+ }
155
+ else if (bignumber_js_1.default.isBigNumber(input)) {
156
+ return input.toNumber().toLocaleString();
157
+ }
158
+ else {
159
+ return 'ERROR';
160
+ }
161
+ }
162
+ exports.numWithComma = numWithComma;
163
+ function numFormat_(input, decimal = 6) {
164
+ const input_bn = new bignumber_js_1.default(input);
165
+ if (input_bn.isInteger()) {
166
+ return numWithComma(input_bn);
167
+ }
168
+ else {
169
+ return numWithComma(input_bn.toFixed(decimal, 1));
170
+ }
171
+ }
172
+ exports.numFormat_ = numFormat_;
173
+ function getPriceAndDY(pair, amount = '-1', x_to_y = true) {
174
+ try {
175
+ const balance_x = x_to_y ? pair.balance_x : pair.balance_y;
176
+ const balance_y = x_to_y ? pair.balance_y : pair.balance_x;
177
+ const decimal_x = x_to_y ? pair.token_x.decimal : pair.token_y.decimal;
178
+ const decimal_y = x_to_y ? pair.token_y.decimal : pair.token_x.decimal;
179
+ let dx2 = new bignumber_js_1.default(10).exponentiatedBy(decimal_x).multipliedBy(amount).multipliedBy(0.997);
180
+ if (amount == '-1') {
181
+ dx2 = new bignumber_js_1.default(1);
182
+ }
183
+ if (dx2.comparedTo(balance_x) >= 0) {
184
+ return { dy: '0', output_price: '0' };
185
+ }
186
+ const dy2 = (new bignumber_js_1.default(balance_y).multipliedBy(dx2)).dividedBy(new bignumber_js_1.default(balance_x).plus(dx2));
187
+ const output_price2 = ((new bignumber_js_1.default(10).exponentiatedBy(decimal_y)).dividedBy(new bignumber_js_1.default(10).exponentiatedBy(decimal_x))).toNumber() * ((dx2).toNumber() / (dy2).toNumber());
188
+ const output_price_final = output_price2.toString();
189
+ const dy_final = dy2.dividedBy(new bignumber_js_1.default(10).exponentiatedBy(decimal_y)).toString();
190
+ if (amount == '-1') {
191
+ return { dy: '0', output_price: output_price_final };
192
+ }
193
+ return { dy: dy_final, output_price: output_price_final };
194
+ }
195
+ catch (e) {
196
+ return { dy: '0', output_price: '0' };
197
+ }
198
+ }
199
+ exports.getPriceAndDY = getPriceAndDY;
200
+ function getAmountWithDecimalString(amount, decimal) {
201
+ bignumber_js_1.default.config({ EXPONENTIAL_AT: 40 });
202
+ try {
203
+ return new bignumber_js_1.default(10 ** decimal).multipliedBy(amount).toString();
204
+ }
205
+ catch (e) {
206
+ return new bignumber_js_1.default(10 ** decimal).multipliedBy(new bignumber_js_1.default(amount)).toString();
207
+ }
208
+ }
209
+ exports.getAmountWithDecimalString = getAmountWithDecimalString;
210
+ function getAmountStringWithDecimal(amount, decimal) {
211
+ try {
212
+ return new bignumber_js_1.default(10 ** decimal).multipliedBy(amount).toString();
213
+ }
214
+ catch (e) {
215
+ return new bignumber_js_1.default(10 ** decimal).multipliedBy(new bignumber_js_1.default(amount)).toString();
216
+ }
217
+ }
218
+ exports.getAmountStringWithDecimal = getAmountStringWithDecimal;
219
219
  //# sourceMappingURL=util.js.map
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
- {
2
- "name": "stackswap-front-api-test-02",
3
- "version": "1.0.84",
4
- "description": "",
5
- "scripts": {
6
- "start": "tsc -b tsconfig.build.json --watch --verbose",
7
- "build": "npm run clean && npm run build:cjs && npm run build:esm",
8
- "build:cjs": "tsc -b tsconfig.build.json",
9
- "build:esm": "tsc -p tsconfig.build.json --module ES6 --outDir ./dist/esm",
10
- "build:umd": "webpack --config webpack.config.js",
11
- "clean": "rimraf dist && tsc -b tsconfig.build.json --clean",
12
- "typecheck": "tsc --noEmit",
13
- "typecheck:watch": "npm run typecheck -- --watch",
14
- "test": "jest --coverage",
15
- "prepublishOnly": "npm run build && npm run build:umd"
16
- },
17
- "keywords": [],
18
- "author": "",
19
- "license": "ISC",
20
- "dependencies": {
21
- "@stacks/connect": "^6.4.0",
22
- "@stacks/transactions": "^3.1.0",
23
- "axios": "^0.21.1",
24
- "bignumber.js": "^9.0.1"
25
- },
26
- "devDependencies": {
27
- "regenerator-runtime": "^0.13.9",
28
- "rimraf": "^3.0.2",
29
- "ts-loader": "^9.1.1",
30
- "typescript": "^4.2.4",
31
- "webpack": "^5.36.1",
32
- "webpack-cli": "^4.6.0"
33
- },
34
- "files": [
35
- "dist",
36
- "src"
37
- ],
38
- "main": "dist/index.js",
39
- "module": "dist/esm/index.js",
40
- "typings": "dist/index.d.ts",
41
- "umd:main": "dist/index.umd.js",
42
- "unpkg": "dist/index.umd.js"
43
- }
1
+ {
2
+ "name": "stackswap-front-api-test-02",
3
+ "version": "1.0.85",
4
+ "description": "",
5
+ "scripts": {
6
+ "start": "tsc -b tsconfig.build.json --watch --verbose",
7
+ "build": "npm run clean && npm run build:cjs && npm run build:esm",
8
+ "build:cjs": "tsc -b tsconfig.build.json",
9
+ "build:esm": "tsc -p tsconfig.build.json --module ES6 --outDir ./dist/esm",
10
+ "build:umd": "webpack --config webpack.config.js",
11
+ "clean": "rimraf dist && tsc -b tsconfig.build.json --clean",
12
+ "typecheck": "tsc --noEmit",
13
+ "typecheck:watch": "npm run typecheck -- --watch",
14
+ "test": "jest --coverage",
15
+ "prepublishOnly": "npm run build && npm run build:umd"
16
+ },
17
+ "keywords": [],
18
+ "author": "",
19
+ "license": "ISC",
20
+ "dependencies": {
21
+ "@stacks/connect": "^6.4.0",
22
+ "@stacks/transactions": "^3.1.0",
23
+ "axios": "^0.21.1",
24
+ "bignumber.js": "^9.0.1"
25
+ },
26
+ "devDependencies": {
27
+ "regenerator-runtime": "^0.13.9",
28
+ "rimraf": "^3.0.2",
29
+ "ts-loader": "^9.1.1",
30
+ "typescript": "^4.2.4",
31
+ "webpack": "^5.36.1",
32
+ "webpack-cli": "^4.6.0"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "src"
37
+ ],
38
+ "main": "dist/index.js",
39
+ "module": "dist/esm/index.js",
40
+ "typings": "dist/index.d.ts",
41
+ "umd:main": "dist/index.umd.js",
42
+ "unpkg": "dist/index.umd.js"
43
+ }