@gala-chain/launchpad 1.0.2 → 1.0.4

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 (68) hide show
  1. package/lib/package.json +2 -2
  2. package/lib/src/api/types/LaunchpadBatchSubmitAuthorities.js.map +1 -1
  3. package/lib/src/api/types/LaunchpadFeeConfig.js +1 -2
  4. package/lib/src/api/types/LaunchpadFeeConfig.js.map +1 -1
  5. package/lib/src/api/types/LaunchpadFinalizeAllocation.js +1 -2
  6. package/lib/src/api/types/LaunchpadFinalizeAllocation.js.map +1 -1
  7. package/lib/src/api/types/LaunchpadSale.js +1 -2
  8. package/lib/src/api/types/LaunchpadSale.js.map +1 -1
  9. package/lib/src/api/validators/decorators.js.map +1 -1
  10. package/lib/src/chaincode/LaunchpadContract.d.ts.map +1 -1
  11. package/lib/src/chaincode/LaunchpadContract.js +13 -0
  12. package/lib/src/chaincode/LaunchpadContract.js.map +1 -1
  13. package/lib/src/chaincode/launchpad/buyExactToken.d.ts.map +1 -1
  14. package/lib/src/chaincode/launchpad/buyExactToken.js +8 -10
  15. package/lib/src/chaincode/launchpad/buyExactToken.js.map +1 -1
  16. package/lib/src/chaincode/launchpad/buyWithNative.d.ts.map +1 -1
  17. package/lib/src/chaincode/launchpad/buyWithNative.js +8 -10
  18. package/lib/src/chaincode/launchpad/buyWithNative.js.map +1 -1
  19. package/lib/src/chaincode/launchpad/callMemeTokenIn.d.ts.map +1 -1
  20. package/lib/src/chaincode/launchpad/callMemeTokenIn.js +0 -4
  21. package/lib/src/chaincode/launchpad/callMemeTokenIn.js.map +1 -1
  22. package/lib/src/chaincode/launchpad/callMemeTokenOut.d.ts.map +1 -1
  23. package/lib/src/chaincode/launchpad/callMemeTokenOut.js +2 -5
  24. package/lib/src/chaincode/launchpad/callMemeTokenOut.js.map +1 -1
  25. package/lib/src/chaincode/launchpad/callNativeTokenIn.d.ts.map +1 -1
  26. package/lib/src/chaincode/launchpad/callNativeTokenIn.js +2 -5
  27. package/lib/src/chaincode/launchpad/callNativeTokenIn.js.map +1 -1
  28. package/lib/src/chaincode/launchpad/callNativeTokenOut.d.ts.map +1 -1
  29. package/lib/src/chaincode/launchpad/callNativeTokenOut.js +3 -6
  30. package/lib/src/chaincode/launchpad/callNativeTokenOut.js.map +1 -1
  31. package/lib/src/chaincode/launchpad/configureLaunchpadFeeConfig.js.map +1 -1
  32. package/lib/src/chaincode/launchpad/createSale.d.ts.map +1 -1
  33. package/lib/src/chaincode/launchpad/createSale.js +10 -12
  34. package/lib/src/chaincode/launchpad/createSale.js.map +1 -1
  35. package/lib/src/chaincode/launchpad/fees.js.map +1 -1
  36. package/lib/src/chaincode/launchpad/fetchLaunchpadAdressConfig.js.map +1 -1
  37. package/lib/src/chaincode/launchpad/fetchSaleDetails.d.ts.map +1 -1
  38. package/lib/src/chaincode/launchpad/fetchSaleDetails.js +0 -4
  39. package/lib/src/chaincode/launchpad/fetchSaleDetails.js.map +1 -1
  40. package/lib/src/chaincode/launchpad/finaliseSale.js.map +1 -1
  41. package/lib/src/chaincode/launchpad/finalizeTokenAllocation.js.map +1 -1
  42. package/lib/src/chaincode/launchpad/launchpadBatchSubmitAuthorizations.js.map +1 -1
  43. package/lib/src/chaincode/launchpad/preMintCalculation.d.ts.map +1 -1
  44. package/lib/src/chaincode/launchpad/preMintCalculation.js +0 -4
  45. package/lib/src/chaincode/launchpad/preMintCalculation.js.map +1 -1
  46. package/lib/src/chaincode/launchpad/sellExactToken.d.ts.map +1 -1
  47. package/lib/src/chaincode/launchpad/sellExactToken.js +0 -3
  48. package/lib/src/chaincode/launchpad/sellExactToken.js.map +1 -1
  49. package/lib/src/chaincode/launchpad/sellWithNative.d.ts.map +1 -1
  50. package/lib/src/chaincode/launchpad/sellWithNative.js +6 -8
  51. package/lib/src/chaincode/launchpad/sellWithNative.js.map +1 -1
  52. package/lib/src/chaincode/utils/launchpadSaleUtils.js +2 -2
  53. package/lib/src/chaincode/utils/launchpadSaleUtils.js.map +1 -1
  54. package/lib/src/cli.js.map +1 -1
  55. package/lib/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +2 -2
  57. package/src/chaincode/LaunchpadContract.ts +9 -0
  58. package/src/chaincode/launchpad/buyExactToken.ts +1 -5
  59. package/src/chaincode/launchpad/buyWithNative.ts +1 -5
  60. package/src/chaincode/launchpad/callMemeTokenIn.ts +1 -5
  61. package/src/chaincode/launchpad/callMemeTokenOut.ts +1 -5
  62. package/src/chaincode/launchpad/callNativeTokenIn.ts +1 -5
  63. package/src/chaincode/launchpad/callNativeTokenOut.ts +1 -5
  64. package/src/chaincode/launchpad/createSale.ts +1 -5
  65. package/src/chaincode/launchpad/fetchSaleDetails.ts +0 -5
  66. package/src/chaincode/launchpad/preMintCalculation.ts +0 -5
  67. package/src/chaincode/launchpad/sellExactToken.ts +0 -4
  68. package/src/chaincode/launchpad/sellWithNative.ts +1 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gala-chain/launchpad",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "GalaChain Launchpad Chaincode",
5
5
  "main": "lib/src/index.js",
6
6
  "types": "lib/src/index.d.ts",
@@ -49,6 +49,6 @@
49
49
  "prettier": "^3.1.1",
50
50
  "ts-jest": "^29.1.2",
51
51
  "ts-node": "^10.9.1",
52
- "typescript": "^5.3.3"
52
+ "typescript": "^5.1.6"
53
53
  }
54
54
  }
@@ -20,6 +20,7 @@ import {
20
20
  GalaChainContext,
21
21
  GalaContract,
22
22
  GalaTransaction,
23
+ SUBMIT,
23
24
  Submit,
24
25
  getApiMethod
25
26
  } from "@gala-chain/chaincode";
@@ -220,6 +221,14 @@ export class LaunchpadContract extends GalaContract {
220
221
  return fetchLaunchpadFeeConfig(ctx);
221
222
  }
222
223
 
224
+ @GalaTransaction({
225
+ type: SUBMIT,
226
+ in: BatchDto,
227
+ out: "object",
228
+ description: "Submit a batch of transactions",
229
+ enforceUniqueKey: true,
230
+ verifySignature: true
231
+ })
223
232
  public async BatchSubmit(ctx: GalaChainContext, batchDto: BatchDto): Promise<GalaChainResponse<unknown>[]> {
224
233
  // Check if the calling user is authorized to submit batches
225
234
  const batchAuthorities = await fetchLaunchpadBatchSubmitAuthorities(ctx);
@@ -13,7 +13,7 @@
13
13
  * limitations under the License.
14
14
  */
15
15
  import { GalaChainContext, fetchTokenClass, putChainObject, transferToken } from "@gala-chain/chaincode";
16
- import { BigNumber } from "bignumber.js";
16
+ import BigNumber from "bignumber.js";
17
17
 
18
18
  import { ExactTokenQuantityDto, LaunchpadSale, TradeResDto } from "../../api/types";
19
19
  import { SlippageToleranceExceededError } from "../../api/utils/error";
@@ -21,10 +21,6 @@ import { fetchAndValidateSale, fetchLaunchpadFeeAddress } from "../utils";
21
21
  import { callNativeTokenIn } from "./callNativeTokenIn";
22
22
  import { finalizeSale } from "./finaliseSale";
23
23
 
24
- BigNumber.config({
25
- ROUNDING_MODE: BigNumber.ROUND_UP
26
- });
27
-
28
24
  /**
29
25
  * Executes the purchase of an exact amount of tokens in a token sale.
30
26
  *
@@ -13,7 +13,7 @@
13
13
  * limitations under the License.
14
14
  */
15
15
  import { GalaChainContext, fetchTokenClass, putChainObject, transferToken } from "@gala-chain/chaincode";
16
- import { BigNumber } from "bignumber.js";
16
+ import BigNumber from "bignumber.js";
17
17
 
18
18
  import { ExactTokenQuantityDto, LaunchpadSale, NativeTokenQuantityDto, TradeResDto } from "../../api/types";
19
19
  import { SlippageToleranceExceededError } from "../../api/utils/error";
@@ -22,10 +22,6 @@ import { callMemeTokenOut } from "./callMemeTokenOut";
22
22
  import { callNativeTokenIn } from "./callNativeTokenIn";
23
23
  import { finalizeSale } from "./finaliseSale";
24
24
 
25
- BigNumber.config({
26
- ROUNDING_MODE: BigNumber.ROUND_UP
27
- });
28
-
29
25
  /**
30
26
  * Executes the purchase of tokens using a specified amount of native tokens.
31
27
  *
@@ -14,17 +14,13 @@
14
14
  */
15
15
  import { ValidationFailedError } from "@gala-chain/api";
16
16
  import { GalaChainContext } from "@gala-chain/chaincode";
17
- import { BigNumber } from "bignumber.js";
17
+ import BigNumber from "bignumber.js";
18
18
  import Decimal from "decimal.js";
19
19
 
20
20
  import { LaunchpadSale, NativeTokenQuantityDto } from "../../api/types";
21
21
  import { fetchAndValidateSale, fetchLaunchpadFeeAddress, getBondingConstants } from "../utils";
22
22
  import { calculateReverseBondingCurveFee, calculateTransactionFee } from "./fees";
23
23
 
24
- BigNumber.config({
25
- ROUNDING_MODE: BigNumber.ROUND_UP
26
- });
27
-
28
24
  function calculateMemeTokensRequired(sale: LaunchpadSale, requestedNativeTokenQuantity: BigNumber) {
29
25
  const totalTokensSold = new Decimal(sale.fetchTokensSold()); // current tokens sold / x
30
26
  let nativeTokens = new Decimal(requestedNativeTokenQuantity.toString()); // native tokens used to buy / y
@@ -13,17 +13,13 @@
13
13
  * limitations under the License.
14
14
  */
15
15
  import { GalaChainContext } from "@gala-chain/chaincode";
16
- import { BigNumber } from "bignumber.js";
16
+ import BigNumber from "bignumber.js";
17
17
  import Decimal from "decimal.js";
18
18
 
19
19
  import { LaunchpadSale, NativeTokenQuantityDto } from "../../api/types";
20
20
  import { fetchAndValidateSale, fetchLaunchpadFeeAddress, getBondingConstants } from "../utils";
21
21
  import { calculateTransactionFee } from "./fees";
22
22
 
23
- BigNumber.config({
24
- ROUNDING_MODE: BigNumber.ROUND_UP
25
- });
26
-
27
23
  /**
28
24
  * Calculates the number of tokens that can be purchased using a specified amount
29
25
  * of native tokens based on a bonding curve mechanism.
@@ -13,17 +13,13 @@
13
13
  * limitations under the License.
14
14
  */
15
15
  import { GalaChainContext } from "@gala-chain/chaincode";
16
- import { BigNumber } from "bignumber.js";
16
+ import BigNumber from "bignumber.js";
17
17
  import Decimal from "decimal.js";
18
18
 
19
19
  import { ExactTokenQuantityDto } from "../../api/types";
20
20
  import { fetchAndValidateSale, fetchLaunchpadFeeAddress, getBondingConstants } from "../utils";
21
21
  import { calculateTransactionFee } from "./fees";
22
22
 
23
- BigNumber.config({
24
- ROUNDING_MODE: BigNumber.ROUND_UP
25
- });
26
-
27
23
  /**
28
24
  * Calculates the amount of native tokens required to purchase a specified amount
29
25
  * of tokens using a bonding curve mechanism.
@@ -13,17 +13,13 @@
13
13
  * limitations under the License.
14
14
  */
15
15
  import { GalaChainContext } from "@gala-chain/chaincode";
16
- import { BigNumber } from "bignumber.js";
16
+ import BigNumber from "bignumber.js";
17
17
  import Decimal from "decimal.js";
18
18
 
19
19
  import { ExactTokenQuantityDto, LaunchpadSale } from "../../api/types";
20
20
  import { fetchAndValidateSale, fetchLaunchpadFeeAddress, getBondingConstants } from "../utils";
21
21
  import { calculateReverseBondingCurveFee, calculateTransactionFee } from "./fees";
22
22
 
23
- BigNumber.config({
24
- ROUNDING_MODE: BigNumber.ROUND_UP
25
- });
26
-
27
23
  function calculateNativeTokensReceived(sale: LaunchpadSale, tokensToSellBn: BigNumber) {
28
24
  const totalTokensSold = new Decimal(sale.fetchTokensSold());
29
25
 
@@ -21,16 +21,12 @@ import {
21
21
  putChainObject,
22
22
  updateTokenClass
23
23
  } from "@gala-chain/chaincode";
24
- import { BigNumber } from "bignumber.js";
24
+ import BigNumber from "bignumber.js";
25
25
 
26
26
  import { CreateSaleResDto, CreateTokenSaleDTO, LaunchpadSale, NativeTokenQuantityDto } from "../../api/types";
27
27
  import { PreConditionFailedError } from "../../api/utils/error";
28
28
  import { buyWithNative } from "./buyWithNative";
29
29
 
30
- BigNumber.config({
31
- ROUNDING_MODE: BigNumber.ROUND_UP
32
- });
33
-
34
30
  /**
35
31
  * Creates a new token sale (Launchpad) in the GalaChain environment.
36
32
  *
@@ -14,14 +14,9 @@
14
14
  */
15
15
  import { NotFoundError } from "@gala-chain/api";
16
16
  import { GalaChainContext, getObjectByKey } from "@gala-chain/chaincode";
17
- import { BigNumber } from "bignumber.js";
18
17
 
19
18
  import { FetchSaleDto, LaunchpadSale } from "../../api/types";
20
19
 
21
- BigNumber.config({
22
- ROUNDING_MODE: BigNumber.ROUND_UP
23
- });
24
-
25
20
  /**
26
21
  * Fetches the details of a specific token sale (LaunchpadSale) using its sale address.
27
22
  *
@@ -12,16 +12,11 @@
12
12
  * See the License for the specific language governing permissions and
13
13
  * limitations under the License.
14
14
  */
15
- import { BigNumber } from "bignumber.js";
16
15
  import Decimal from "decimal.js";
17
16
 
18
17
  import { LaunchpadSale, PreMintCalculationDto } from "../../api/types";
19
18
  import { getBondingConstants } from "../utils";
20
19
 
21
- BigNumber.config({
22
- ROUNDING_MODE: BigNumber.ROUND_UP
23
- });
24
-
25
20
  /**
26
21
  * Calculates the number of tokens that can be purchased using a specified amount
27
22
  * of native tokens based on a bonding curve mechanism.
@@ -22,10 +22,6 @@ import { fetchAndValidateSale, fetchLaunchpadFeeAddress } from "../utils";
22
22
  import { callNativeTokenOut } from "./callNativeTokenOut";
23
23
  import { payReverseBondingCurveFee } from "./fees";
24
24
 
25
- BigNumber.config({
26
- ROUNDING_MODE: BigNumber.ROUND_UP
27
- });
28
-
29
25
  /**
30
26
  * Executes the sale of an exact amount of tokens for native tokens (e.g., GALA).
31
27
  *
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import { ValidationFailedError } from "@gala-chain/api";
16
16
  import { GalaChainContext, fetchTokenClass, putChainObject, transferToken } from "@gala-chain/chaincode";
17
- import { BigNumber } from "bignumber.js";
17
+ import BigNumber from "bignumber.js";
18
18
 
19
19
  import { NativeTokenQuantityDto, TradeResDto } from "../../api/types";
20
20
  import { SlippageToleranceExceededError } from "../../api/utils/error";
@@ -22,10 +22,6 @@ import { fetchAndValidateSale, fetchLaunchpadFeeAddress } from "../utils";
22
22
  import { callMemeTokenIn } from "./callMemeTokenIn";
23
23
  import { payReverseBondingCurveFee } from "./fees";
24
24
 
25
- BigNumber.config({
26
- ROUNDING_MODE: BigNumber.ROUND_UP
27
- });
28
-
29
25
  /**
30
26
  * Executes a sale of tokens using native tokens (e.g., GALA) in exchange for the specified token amount.
31
27
  *