@evergonlabs/tmi-protocol-api 0.10.1 → 0.11.0-rc.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.
- package/dist/app.d.ts +384 -76
- package/dist/app.d.ts.map +1 -1
- package/dist/client.d.ts +408 -76
- package/dist/client.d.ts.map +1 -1
- package/dist/common/blockchain.d.ts +8700 -64
- package/dist/common/blockchain.d.ts.map +1 -1
- package/dist/common/blockchain.js +5 -1
- package/dist/common/config.d.ts +5 -0
- package/dist/common/config.d.ts.map +1 -1
- package/dist/common/config.js +5 -0
- package/dist/common/indexer/client.d.ts.map +1 -1
- package/dist/common/indexer/schemas.d.ts.map +1 -1
- package/dist/common/models/asset.d.ts +1 -1
- package/dist/common/models/base/chainId.d.ts +5 -5
- package/dist/common/models/base/chainId.d.ts.map +1 -1
- package/dist/common/models/chainId.d.ts +5 -5
- package/dist/common/models/chainId.d.ts.map +1 -1
- package/dist/common/models/transaction.d.ts +1 -1
- package/dist/fractions/index.d.ts +18 -57
- package/dist/fractions/index.d.ts.map +1 -1
- package/dist/fractions/markets/common/platform.d.ts +2 -2
- package/dist/fractions/markets/deployMarket.routes.d.ts.map +1 -0
- package/dist/fractions/{platforms → markets}/deployMarket.routes.js +16 -16
- package/dist/fractions/{platforms → markets}/deployMarket.schema.d.ts +1 -1
- package/dist/fractions/markets/deployMarket.schema.d.ts.map +1 -0
- package/dist/fractions/markets/getMarket/getMarket.d.ts +1 -1
- package/dist/fractions/markets/getMarket/index.d.ts +1 -1
- package/dist/fractions/markets/index.d.ts +1 -1
- package/dist/fractions/markets/initCompilot.routes.d.ts.map +1 -0
- package/dist/fractions/{platforms → markets}/initCompilot.routes.js +4 -5
- package/dist/fractions/platforms/index.d.ts +4 -4
- package/dist/fractions/platforms/index.d.ts.map +1 -1
- package/dist/fractions/platforms/index.js +4 -4
- package/dist/fractions/roles/grantRole.schema.d.ts +1 -1
- package/dist/fractions/sales/activityUtils.d.ts +1 -1
- package/dist/fractions/sales/approveWrapper.route.d.ts +0 -58
- package/dist/fractions/sales/approveWrapper.route.d.ts.map +1 -1
- package/dist/fractions/sales/approveWrapper.route.js +1 -59
- package/dist/fractions/sales/common/fractionsSale.d.ts +4 -4
- package/dist/fractions/sales/createFractions.schema.d.ts +1 -1
- package/dist/fractions/sales/getFractionSaleStatistics.route.d.ts +2 -2
- package/dist/fractions/sales/getFractionSaleStatistics.route.js +1 -1
- package/dist/fractions/sales/getVaultAddress.d.ts +1 -1
- package/dist/fractions/sales/index.d.ts +6 -53
- package/dist/fractions/sales/index.d.ts.map +1 -1
- package/dist/fractions/sales/index.js +1 -3
- package/dist/fractions/sales/parseFractionsCreatedEvent.js +2 -2
- package/dist/fractions/sales/purchase.route.d.ts +1 -1
- package/dist/fractions/sales/purchaseStatistics.route.d.ts +1 -1
- package/dist/fractions/sales/purchaseStatistics.route.js +1 -1
- package/dist/fractions/sales/searchActivity.route.d.ts +1 -1
- package/dist/fractions/sales/vesting/claimStatistics.route.d.ts +3 -3
- package/dist/fractions/sig/getAuthData.d.ts +1 -1
- package/dist/fractions/sig/getNonce.route.d.ts +1 -1
- package/dist/fractions/statistics/index.d.ts +8 -0
- package/dist/fractions/statistics/index.d.ts.map +1 -1
- package/dist/fractions/statistics/networkStatistics.route.d.ts +8 -0
- package/dist/fractions/statistics/networkStatistics.route.d.ts.map +1 -1
- package/dist/issuance/common/factories.base.d.ts +649 -5
- package/dist/issuance/common/factories.base.d.ts.map +1 -1
- package/dist/issuance/common/factories.base.js +2 -2
- package/dist/issuance/common/factories.d.ts +1 -1
- package/dist/issuance/common/factories.d.ts.map +1 -1
- package/dist/issuance/erc1155/default/deploy.d.ts +2 -2
- package/dist/issuance/erc1155/gated/deploy.d.ts +2 -2
- package/dist/issuance/erc1155/getMintedTokenId.d.ts +18 -0
- package/dist/issuance/erc1155/getMintedTokenId.d.ts.map +1 -0
- package/dist/issuance/erc1155/getMintedTokenId.js +81 -0
- package/dist/issuance/erc1155/index.d.ts +19 -3
- package/dist/issuance/erc1155/index.d.ts.map +1 -1
- package/dist/issuance/erc1155/index.js +3 -1
- package/dist/issuance/erc20/default/deploy.d.ts +2 -2
- package/dist/issuance/erc20/gated/deploy.d.ts +2 -2
- package/dist/issuance/erc20/index.d.ts +2 -2
- package/dist/issuance/erc721/default/deploy.d.ts +2 -2
- package/dist/issuance/erc721/gated/deploy.d.ts +2 -2
- package/dist/issuance/erc721/getMintedTokenId.d.ts +18 -0
- package/dist/issuance/erc721/getMintedTokenId.d.ts.map +1 -0
- package/dist/issuance/erc721/getMintedTokenId.js +79 -0
- package/dist/issuance/erc721/index.d.ts +19 -3
- package/dist/issuance/erc721/index.d.ts.map +1 -1
- package/dist/issuance/erc721/index.js +3 -1
- package/dist/issuance/index.d.ts +40 -8
- package/dist/issuance/index.d.ts.map +1 -1
- package/dist/next/fractions/index.d.ts +319 -4
- package/dist/next/fractions/index.d.ts.map +1 -1
- package/dist/next/fractions/index.js +3 -1
- package/dist/next/fractions/lending/buyback/buyback.schema.d.ts +1 -1
- package/dist/next/fractions/lending/createLendingSale.d.ts +1 -1
- package/dist/next/fractions/lending/schemas.d.ts +1 -1
- package/dist/next/fractions/lending/schemas.js +1 -1
- package/dist/next/fractions/platforms/default/deployNftFractionsMarket.schema.d.ts +1 -1
- package/dist/next/fractions/platforms/default/deployNftFractionsMarket.schema.js +1 -1
- package/dist/next/fractions/platforms/gated/deployNftFractionsMarket.schema.d.ts +1 -1
- package/dist/next/fractions/platforms/gated/deployNftFractionsMarket.schema.js +1 -1
- package/dist/next/fractions/sales/createNftFractions.routes.d.ts +13 -3
- package/dist/next/fractions/sales/createNftFractions.routes.d.ts.map +1 -1
- package/dist/next/fractions/sales/createNftFractions.routes.js +16 -8
- package/dist/next/fractions/sales/createNftFractions.schema.d.ts +14 -11
- package/dist/next/fractions/sales/createNftFractions.schema.d.ts.map +1 -1
- package/dist/next/fractions/sales/createNftFractions.schema.js +2 -8
- package/dist/next/fractions/sales/index.d.ts +13 -3
- package/dist/next/fractions/sales/index.d.ts.map +1 -1
- package/dist/next/fractions/vestingRedemptionDynamic/approveCampaign.routes.d.ts +25 -0
- package/dist/next/fractions/vestingRedemptionDynamic/approveCampaign.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/approveCampaign.routes.js +35 -0
- package/dist/next/fractions/vestingRedemptionDynamic/createCampaign.routes.d.ts +52 -0
- package/dist/next/fractions/vestingRedemptionDynamic/createCampaign.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/createCampaign.routes.js +50 -0
- package/dist/next/fractions/vestingRedemptionDynamic/createCampaign.schema.d.ts +43 -0
- package/dist/next/fractions/vestingRedemptionDynamic/createCampaign.schema.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/createCampaign.schema.js +48 -0
- package/dist/next/fractions/vestingRedemptionDynamic/deployMarket.routes.d.ts +39 -0
- package/dist/next/fractions/vestingRedemptionDynamic/deployMarket.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/deployMarket.routes.js +39 -0
- package/dist/next/fractions/vestingRedemptionDynamic/deployMarket.schema.d.ts +23 -0
- package/dist/next/fractions/vestingRedemptionDynamic/deployMarket.schema.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/deployMarket.schema.js +29 -0
- package/dist/next/fractions/vestingRedemptionDynamic/epochPurchase.routes.d.ts +51 -0
- package/dist/next/fractions/vestingRedemptionDynamic/epochPurchase.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/epochPurchase.routes.js +74 -0
- package/dist/next/fractions/vestingRedemptionDynamic/epochWithdrawal.routes.d.ts +51 -0
- package/dist/next/fractions/vestingRedemptionDynamic/epochWithdrawal.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/epochWithdrawal.routes.js +75 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getCurrentEpoch.routes.d.ts +19 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getCurrentEpoch.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getCurrentEpoch.routes.js +52 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getEpochPurchaseEvent.routes.d.ts +23 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getEpochPurchaseEvent.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getEpochPurchaseEvent.routes.js +67 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getPurchasePriceForEpoch.routes.d.ts +20 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getPurchasePriceForEpoch.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getPurchasePriceForEpoch.routes.js +59 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getWithdrawalRequestedEvent.routes.d.ts +21 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getWithdrawalRequestedEvent.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/getWithdrawalRequestedEvent.routes.js +63 -0
- package/dist/next/fractions/vestingRedemptionDynamic/index.d.ts +307 -0
- package/dist/next/fractions/vestingRedemptionDynamic/index.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/index.js +27 -0
- package/dist/next/fractions/vestingRedemptionDynamic/setEpochPrice.routes.d.ts +26 -0
- package/dist/next/fractions/vestingRedemptionDynamic/setEpochPrice.routes.d.ts.map +1 -0
- package/dist/next/fractions/vestingRedemptionDynamic/setEpochPrice.routes.js +41 -0
- package/dist/staking/index.d.ts +7 -7
- package/dist/staking/platforms/common/platform.d.ts +1 -1
- package/dist/staking/platforms/getPlatform/index.d.ts +1 -1
- package/dist/staking/platforms/getPlatform/v0/getPlatform.d.ts +1 -1
- package/dist/staking/platforms/index.d.ts +2 -2
- package/dist/staking/platforms/searchPlatforms/index.d.ts +1 -1
- package/dist/staking/platforms/searchPlatforms/v0/searchPlatforms.d.ts +1 -1
- package/dist/staking/pools/common/pool.d.ts +1 -1
- package/dist/staking/pools/getPool/index.d.ts +1 -1
- package/dist/staking/pools/getPool/v0/getPool.d.ts +1 -1
- package/dist/staking/pools/index.d.ts +2 -2
- package/dist/staking/pools/searchPools/index.d.ts +1 -1
- package/dist/staking/pools/searchPools/v0/searchPools.d.ts +1 -1
- package/dist/staking/roles/common/roleAssignment.d.ts +1 -1
- package/dist/staking/roles/common/roleEvent.d.ts +1 -1
- package/dist/staking/roles/index.d.ts +2 -2
- package/dist/staking/roles/searchRoleEvents/index.d.ts +1 -1
- package/dist/staking/roles/searchRoleEvents/v0/searchRoleEvents.d.ts +1 -1
- package/dist/staking/roles/searchRoles/index.d.ts +1 -1
- package/dist/staking/roles/searchRoles/v0/searchRoles.d.ts +1 -1
- package/dist/staking/stakes/common/stake.d.ts +1 -1
- package/dist/staking/stakes/common/stakeEvent.d.ts +1 -1
- package/dist/staking/stakes/index.d.ts +1 -1
- package/dist/staking/stakes/searchStakeEvents/index.d.ts +1 -1
- package/dist/staking/stakes/searchStakeEvents/v0/searchStakeEvents.d.ts +1 -1
- package/package.json +10 -10
- package/dist/fractions/platforms/deployMarket.routes.d.ts.map +0 -1
- package/dist/fractions/platforms/deployMarket.schema.d.ts.map +0 -1
- package/dist/fractions/platforms/initCompilot.routes.d.ts.map +0 -1
- /package/dist/fractions/{platforms → markets}/deployMarket.routes.d.ts +0 -0
- /package/dist/fractions/{platforms → markets}/deployMarket.schema.js +0 -0
- /package/dist/fractions/{platforms → markets}/initCompilot.routes.d.ts +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { buildRequestWithdrawalTx, buildWithdrawFundsTx } from "@evergonlabs/tmi-protocol-fractions-sdk/next";
|
|
5
|
+
import { createController } from "../../../common/controller.js";
|
|
6
|
+
import { AddressSchema, toTransaction, TransactionSchema } from "../../../common/index.js";
|
|
7
|
+
import { Int256BigInt } from "../../../common/int256.js";
|
|
8
|
+
// ──────────────────────────── Request Withdrawal (step 1) ─────────────────────
|
|
9
|
+
const RequestWithdrawalRequestSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
market: AddressSchema.describe("Address of the Vesting & Redemption Dynamic market"),
|
|
12
|
+
campaignId: Int256BigInt(z.bigint().nonnegative()).describe("Campaign ID"),
|
|
13
|
+
amountOfFractions: Int256BigInt(z.bigint().positive()).describe("Number of ERC-20 fractions to burn (in raw token units with 18 decimals). " +
|
|
14
|
+
"The fractions are burned and a withdrawal receipt NFT is issued."),
|
|
15
|
+
})
|
|
16
|
+
.openapi("RequestWithdrawalRequestSchema");
|
|
17
|
+
const requestWithdrawalRoute = describeRoute({
|
|
18
|
+
summary: "Withdrawal step 1 — burn fractions and receive withdrawal receipt NFT",
|
|
19
|
+
description: "Returns transaction data for the first step of the two-click epoch withdrawal flow. " +
|
|
20
|
+
"The investor burns their ERC-20 fractions and receives a withdrawal receipt NFT. " +
|
|
21
|
+
"The investor can then redeem the receipt NFT for funds in the next or any later epoch.",
|
|
22
|
+
tags: ["Vesting & Redemption Dynamic"],
|
|
23
|
+
responses: {
|
|
24
|
+
200: {
|
|
25
|
+
description: "Returns transaction data for requesting a withdrawal",
|
|
26
|
+
content: {
|
|
27
|
+
"application/json": {
|
|
28
|
+
schema: resolver(TransactionSchema),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export const RequestWithdrawalV0 = createController({
|
|
35
|
+
build: (factory) => factory
|
|
36
|
+
.createApp()
|
|
37
|
+
.post("/", requestWithdrawalRoute, validator("json", RequestWithdrawalRequestSchema), async (c) => {
|
|
38
|
+
const { market, campaignId, amountOfFractions } = c.req.valid("json");
|
|
39
|
+
const tx = buildRequestWithdrawalTx({ market, campaignId, amountOfFractions });
|
|
40
|
+
return c.json(toTransaction(tx));
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
// ──────────────────────────── Withdraw Funds (step 2) ─────────────────────────
|
|
44
|
+
const WithdrawFundsRequestSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
market: AddressSchema.describe("Address of the Vesting & Redemption Dynamic market"),
|
|
47
|
+
campaignId: Int256BigInt(z.bigint().nonnegative()).describe("Campaign ID"),
|
|
48
|
+
nftId: Int256BigInt(z.bigint().nonnegative()).describe("ID of the withdrawal receipt NFT (emitted in the event from step 1)"),
|
|
49
|
+
})
|
|
50
|
+
.openapi("WithdrawFundsRequestSchema");
|
|
51
|
+
const withdrawRoute = describeRoute({
|
|
52
|
+
summary: "Withdrawal step 2 — burn withdrawal receipt NFT and receive funds",
|
|
53
|
+
description: "Returns transaction data for the second step of the two-click epoch withdrawal flow. " +
|
|
54
|
+
"The investor burns their withdrawal receipt NFT and receives funds at the price of epoch N+1, " +
|
|
55
|
+
"where N is the epoch in which the withdrawal was requested. " +
|
|
56
|
+
"This can only be called after the price setter has advanced the epoch at least once since the withdrawal request.",
|
|
57
|
+
tags: ["Vesting & Redemption Dynamic"],
|
|
58
|
+
responses: {
|
|
59
|
+
200: {
|
|
60
|
+
description: "Returns transaction data for withdrawing funds",
|
|
61
|
+
content: {
|
|
62
|
+
"application/json": {
|
|
63
|
+
schema: resolver(TransactionSchema),
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
export const WithdrawFundsV0 = createController({
|
|
70
|
+
build: (factory) => factory.createApp().post("/", withdrawRoute, validator("json", WithdrawFundsRequestSchema), async (c) => {
|
|
71
|
+
const { market, campaignId, nftId } = c.req.valid("json");
|
|
72
|
+
const tx = buildWithdrawFundsTx({ market, campaignId, nftId });
|
|
73
|
+
return c.json(toTransaction(tx));
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const GetCurrentEpochV0: import("../../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../../common/context.js").AppContext, {
|
|
2
|
+
"/": {
|
|
3
|
+
$get: {
|
|
4
|
+
input: {
|
|
5
|
+
query: {
|
|
6
|
+
chainId: string | string[];
|
|
7
|
+
market: string | string[];
|
|
8
|
+
campaignId: string | string[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
output: {
|
|
12
|
+
currentEpoch: string;
|
|
13
|
+
};
|
|
14
|
+
outputFormat: "json";
|
|
15
|
+
status: 200;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}, "/", "/">>;
|
|
19
|
+
//# sourceMappingURL=getCurrentEpoch.routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCurrentEpoch.routes.d.ts","sourceRoot":"","sources":["../../../../src/next/fractions/vestingRedemptionDynamic/getCurrentEpoch.routes.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;aAoC5B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { readContract } from "viem/actions";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { buildGetCurrentEpochCall } from "@evergonlabs/tmi-protocol-fractions-sdk/next";
|
|
6
|
+
import { Int256Json } from "@evergonlabs/tmi-utils/models";
|
|
7
|
+
import { getPublicClient } from "../../../common/blockchain.js";
|
|
8
|
+
import { createController } from "../../../common/controller.js";
|
|
9
|
+
import { AddressSchema, NextFractionsChainId } from "../../../common/index.js";
|
|
10
|
+
import { Int256BigInt } from "../../../common/int256.js";
|
|
11
|
+
const QuerySchema = z.object({
|
|
12
|
+
chainId: NextFractionsChainId.openapi({
|
|
13
|
+
param: { name: "chainId", in: "query" },
|
|
14
|
+
}),
|
|
15
|
+
market: AddressSchema.openapi({
|
|
16
|
+
param: { name: "market", in: "query" },
|
|
17
|
+
description: "Address of the Vesting & Redemption Dynamic market",
|
|
18
|
+
}),
|
|
19
|
+
campaignId: Int256BigInt().openapi({
|
|
20
|
+
param: { name: "campaignId", in: "query" },
|
|
21
|
+
description: "Campaign ID",
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
export const GetCurrentEpochV0 = createController({
|
|
25
|
+
build: (factory) => factory.createApp().get("/", describeRoute({
|
|
26
|
+
summary: "Get current epoch",
|
|
27
|
+
description: "Returns the current epoch number for a Vesting & Redemption Dynamic campaign.",
|
|
28
|
+
tags: ["Vesting & Redemption Dynamic"],
|
|
29
|
+
responses: {
|
|
30
|
+
200: {
|
|
31
|
+
description: "Returns the current epoch number",
|
|
32
|
+
content: {
|
|
33
|
+
"application/json": {
|
|
34
|
+
schema: resolver(z.object({
|
|
35
|
+
currentEpoch: Int256Json.openapi({ description: "Current epoch number", example: "1" }),
|
|
36
|
+
})),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}), validator("query", QuerySchema), async (c) => {
|
|
42
|
+
const { chainId, market, campaignId } = c.req.valid("query");
|
|
43
|
+
const publicClient = getPublicClient(chainId, c.env.config);
|
|
44
|
+
// account must be the diamond address itself so msg.sender == address(this),
|
|
45
|
+
// satisfying the OnlyInternalDelegateCall modifier on the facet.
|
|
46
|
+
const result = await readContract(publicClient, {
|
|
47
|
+
...buildGetCurrentEpochCall(market, campaignId),
|
|
48
|
+
account: market,
|
|
49
|
+
});
|
|
50
|
+
return c.json({ currentEpoch: result.toString() }, 200);
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const GetEpochPurchaseEventV0: import("../../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../../common/context.js").AppContext, {
|
|
2
|
+
"/": {
|
|
3
|
+
$get: {
|
|
4
|
+
input: {
|
|
5
|
+
query: {
|
|
6
|
+
chainId: string | string[];
|
|
7
|
+
hash: string | string[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
output: {
|
|
11
|
+
campaignId: string;
|
|
12
|
+
nftId: string;
|
|
13
|
+
purchaser: `0x${string}`;
|
|
14
|
+
amountProvided: string;
|
|
15
|
+
amountAfterFees: string;
|
|
16
|
+
epochPurchased: string;
|
|
17
|
+
};
|
|
18
|
+
outputFormat: "json";
|
|
19
|
+
status: 200;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}, "/", "/">>;
|
|
23
|
+
//# sourceMappingURL=getEpochPurchaseEvent.routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEpochPurchaseEvent.routes.d.ts","sourceRoot":"","sources":["../../../../src/next/fractions/vestingRedemptionDynamic/getEpochPurchaseEvent.routes.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;aAoDlC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { waitForTransactionReceipt } from "viem/actions";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { parseNftPurchasedEvent } from "@evergonlabs/tmi-protocol-fractions-sdk/next";
|
|
6
|
+
import { Int256Json } from "@evergonlabs/tmi-utils/models";
|
|
7
|
+
import { getPublicClient } from "../../../common/blockchain.js";
|
|
8
|
+
import { createController } from "../../../common/controller.js";
|
|
9
|
+
import { HttpError } from "../../../common/http-error.js";
|
|
10
|
+
import { AddressSchema, HashSchema, NextFractionsChainId } from "../../../common/index.js";
|
|
11
|
+
const QuerySchema = z.object({
|
|
12
|
+
chainId: NextFractionsChainId.openapi({
|
|
13
|
+
param: { name: "chainId", in: "query" },
|
|
14
|
+
}),
|
|
15
|
+
hash: HashSchema.openapi({
|
|
16
|
+
param: { name: "hash", in: "query" },
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export const GetEpochPurchaseEventV0 = createController({
|
|
20
|
+
build: (factory) => factory.createApp().get("/", describeRoute({
|
|
21
|
+
summary: "Get NftPurchased event",
|
|
22
|
+
description: "Gets the transaction by hash and parses the `NftPurchased` event emitted during step 1 of the two-click epoch purchase flow.",
|
|
23
|
+
tags: ["Vesting & Redemption Dynamic"],
|
|
24
|
+
responses: {
|
|
25
|
+
200: {
|
|
26
|
+
description: "Returns parsed NftPurchased event data",
|
|
27
|
+
content: {
|
|
28
|
+
"application/json": {
|
|
29
|
+
schema: resolver(z.object({
|
|
30
|
+
campaignId: Int256Json.openapi({ description: "Campaign ID", example: "1" }),
|
|
31
|
+
nftId: Int256Json.openapi({ description: "Purchase receipt NFT ID" }),
|
|
32
|
+
purchaser: AddressSchema,
|
|
33
|
+
amountProvided: Int256Json,
|
|
34
|
+
amountAfterFees: Int256Json,
|
|
35
|
+
epochPurchased: Int256Json,
|
|
36
|
+
})),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}), validator("query", QuerySchema), async (c) => {
|
|
42
|
+
const params = c.req.valid("query");
|
|
43
|
+
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
|
|
44
|
+
hash: params.hash,
|
|
45
|
+
});
|
|
46
|
+
const result = parseNftPurchasedEvent(receipt.logs);
|
|
47
|
+
if (!result) {
|
|
48
|
+
throw new UnableParseNftPurchasedEvent();
|
|
49
|
+
}
|
|
50
|
+
return c.json({
|
|
51
|
+
campaignId: result.campaignId.toString(),
|
|
52
|
+
nftId: result.nftId.toString(),
|
|
53
|
+
purchaser: result.purchaser,
|
|
54
|
+
amountProvided: result.amountProvided.toString(),
|
|
55
|
+
amountAfterFees: result.amountAfterFees.toString(),
|
|
56
|
+
epochPurchased: result.epochPurchased.toString(),
|
|
57
|
+
}, 200);
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
class UnableParseNftPurchasedEvent extends HttpError {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(500, {
|
|
63
|
+
message: `Can't parse NftPurchased event. Make sure you're passing a transaction hash from a VRD purchase (step 1).`,
|
|
64
|
+
name: "UnableParseNftPurchasedEvent",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const GetPurchasePriceForEpochV0: import("../../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../../common/context.js").AppContext, {
|
|
2
|
+
"/": {
|
|
3
|
+
$get: {
|
|
4
|
+
input: {
|
|
5
|
+
query: {
|
|
6
|
+
chainId: string | string[];
|
|
7
|
+
market: string | string[];
|
|
8
|
+
campaignId: string | string[];
|
|
9
|
+
epoch: string | string[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
output: {
|
|
13
|
+
price: string;
|
|
14
|
+
};
|
|
15
|
+
outputFormat: "json";
|
|
16
|
+
status: 200;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}, "/", "/">>;
|
|
20
|
+
//# sourceMappingURL=getPurchasePriceForEpoch.routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPurchasePriceForEpoch.routes.d.ts","sourceRoot":"","sources":["../../../../src/next/fractions/vestingRedemptionDynamic/getPurchasePriceForEpoch.routes.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;aAwCrC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { readContract } from "viem/actions";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { buildGetPurchasePriceForEpochCall } from "@evergonlabs/tmi-protocol-fractions-sdk/next";
|
|
6
|
+
import { Int256Json } from "@evergonlabs/tmi-utils/models";
|
|
7
|
+
import { getPublicClient } from "../../../common/blockchain.js";
|
|
8
|
+
import { createController } from "../../../common/controller.js";
|
|
9
|
+
import { AddressSchema, NextFractionsChainId } from "../../../common/index.js";
|
|
10
|
+
import { Int256BigInt } from "../../../common/int256.js";
|
|
11
|
+
const QuerySchema = z.object({
|
|
12
|
+
chainId: NextFractionsChainId.openapi({
|
|
13
|
+
param: { name: "chainId", in: "query" },
|
|
14
|
+
}),
|
|
15
|
+
market: AddressSchema.openapi({
|
|
16
|
+
param: { name: "market", in: "query" },
|
|
17
|
+
description: "Address of the Vesting & Redemption Dynamic market",
|
|
18
|
+
}),
|
|
19
|
+
campaignId: Int256BigInt().openapi({
|
|
20
|
+
param: { name: "campaignId", in: "query" },
|
|
21
|
+
description: "Campaign ID",
|
|
22
|
+
}),
|
|
23
|
+
epoch: Int256BigInt().openapi({
|
|
24
|
+
param: { name: "epoch", in: "query" },
|
|
25
|
+
description: "Epoch number to query the price for",
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
export const GetPurchasePriceForEpochV0 = createController({
|
|
29
|
+
build: (factory) => factory.createApp().get("/", describeRoute({
|
|
30
|
+
summary: "Get purchase price for epoch",
|
|
31
|
+
description: "Returns the purchase price (in funding packets per 10^18 fraction token units) recorded for a specific epoch in a Vesting & Redemption Dynamic campaign.",
|
|
32
|
+
tags: ["Vesting & Redemption Dynamic"],
|
|
33
|
+
responses: {
|
|
34
|
+
200: {
|
|
35
|
+
description: "Returns the epoch price",
|
|
36
|
+
content: {
|
|
37
|
+
"application/json": {
|
|
38
|
+
schema: resolver(z.object({
|
|
39
|
+
price: Int256Json.openapi({
|
|
40
|
+
description: "Price in funding packets per 10^18 fraction token units",
|
|
41
|
+
example: "1000000000000000000",
|
|
42
|
+
}),
|
|
43
|
+
})),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}), validator("query", QuerySchema), async (c) => {
|
|
49
|
+
const { chainId, market, campaignId, epoch } = c.req.valid("query");
|
|
50
|
+
const publicClient = getPublicClient(chainId, c.env.config);
|
|
51
|
+
// account must be the diamond address itself so msg.sender == address(this),
|
|
52
|
+
// satisfying the OnlyInternalDelegateCall modifier on the facet.
|
|
53
|
+
const result = await readContract(publicClient, {
|
|
54
|
+
...buildGetPurchasePriceForEpochCall(market, campaignId, epoch),
|
|
55
|
+
account: market,
|
|
56
|
+
});
|
|
57
|
+
return c.json({ price: result.toString() }, 200);
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const GetWithdrawalRequestedEventV0: import("../../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../../common/context.js").AppContext, {
|
|
2
|
+
"/": {
|
|
3
|
+
$get: {
|
|
4
|
+
input: {
|
|
5
|
+
query: {
|
|
6
|
+
chainId: string | string[];
|
|
7
|
+
hash: string | string[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
output: {
|
|
11
|
+
campaignId: string;
|
|
12
|
+
nftId: string;
|
|
13
|
+
requester: `0x${string}`;
|
|
14
|
+
amountOfFractions: string;
|
|
15
|
+
};
|
|
16
|
+
outputFormat: "json";
|
|
17
|
+
status: 200;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}, "/", "/">>;
|
|
21
|
+
//# sourceMappingURL=getWithdrawalRequestedEvent.routes.d.ts.map
|
package/dist/next/fractions/vestingRedemptionDynamic/getWithdrawalRequestedEvent.routes.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWithdrawalRequestedEvent.routes.d.ts","sourceRoot":"","sources":["../../../../src/next/fractions/vestingRedemptionDynamic/getWithdrawalRequestedEvent.routes.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;aAgDxC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi";
|
|
3
|
+
import { waitForTransactionReceipt } from "viem/actions";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { parseWithdrawalRequestedEvent } from "@evergonlabs/tmi-protocol-fractions-sdk/next";
|
|
6
|
+
import { Int256Json } from "@evergonlabs/tmi-utils/models";
|
|
7
|
+
import { getPublicClient } from "../../../common/blockchain.js";
|
|
8
|
+
import { createController } from "../../../common/controller.js";
|
|
9
|
+
import { HttpError } from "../../../common/http-error.js";
|
|
10
|
+
import { AddressSchema, HashSchema, NextFractionsChainId } from "../../../common/index.js";
|
|
11
|
+
const QuerySchema = z.object({
|
|
12
|
+
chainId: NextFractionsChainId.openapi({
|
|
13
|
+
param: { name: "chainId", in: "query" },
|
|
14
|
+
}),
|
|
15
|
+
hash: HashSchema.openapi({
|
|
16
|
+
param: { name: "hash", in: "query" },
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
export const GetWithdrawalRequestedEventV0 = createController({
|
|
20
|
+
build: (factory) => factory.createApp().get("/", describeRoute({
|
|
21
|
+
summary: "Get WithdrawalRequested event",
|
|
22
|
+
description: "Gets the transaction by hash and parses the `WithdrawalRequested` event emitted during step 1 of the two-click epoch withdrawal flow.",
|
|
23
|
+
tags: ["Vesting & Redemption Dynamic"],
|
|
24
|
+
responses: {
|
|
25
|
+
200: {
|
|
26
|
+
description: "Returns parsed WithdrawalRequested event data",
|
|
27
|
+
content: {
|
|
28
|
+
"application/json": {
|
|
29
|
+
schema: resolver(z.object({
|
|
30
|
+
campaignId: Int256Json.openapi({ description: "Campaign ID", example: "1" }),
|
|
31
|
+
nftId: Int256Json.openapi({ description: "Withdrawal receipt NFT ID" }),
|
|
32
|
+
requester: AddressSchema,
|
|
33
|
+
amountOfFractions: Int256Json,
|
|
34
|
+
})),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}), validator("query", QuerySchema), async (c) => {
|
|
40
|
+
const params = c.req.valid("query");
|
|
41
|
+
const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
|
|
42
|
+
hash: params.hash,
|
|
43
|
+
});
|
|
44
|
+
const result = parseWithdrawalRequestedEvent(receipt.logs);
|
|
45
|
+
if (!result) {
|
|
46
|
+
throw new UnableParseWithdrawalRequestedEvent();
|
|
47
|
+
}
|
|
48
|
+
return c.json({
|
|
49
|
+
campaignId: result.campaignId.toString(),
|
|
50
|
+
nftId: result.nftId.toString(),
|
|
51
|
+
requester: result.requester,
|
|
52
|
+
amountOfFractions: result.amountOfFractions.toString(),
|
|
53
|
+
}, 200);
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
class UnableParseWithdrawalRequestedEvent extends HttpError {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(500, {
|
|
59
|
+
message: `Can't parse WithdrawalRequested event. Make sure you're passing a transaction hash from a VRD requestWithdrawal (step 1).`,
|
|
60
|
+
name: "UnableParseWithdrawalRequestedEvent",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|