@evergonlabs/tmi-protocol-api 0.1.2 → 0.1.3
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 +26 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/client.d.ts +34 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/fractions/index.d.ts +25 -0
- package/dist/fractions/index.d.ts.map +1 -1
- package/dist/fractions/index.js +2 -0
- package/dist/fractions/purchase/v0/statistics.route.d.ts +65 -0
- package/dist/fractions/purchase/v0/statistics.route.d.ts.map +1 -0
- package/dist/fractions/purchase/v0/statistics.route.js +52 -0
- package/dist/general/balanceClient.d.ts +16 -41
- package/dist/general/balanceClient.d.ts.map +1 -1
- package/dist/general/balanceClient.js +1 -18
- package/dist/general/index.d.ts +1 -1
- package/dist/general/searchBalances.d.ts +3 -3
- package/dist/general/searchBalances.js +2 -2
- package/dist/general/utils/tokenBalance/tokenBalance.d.ts +28 -0
- package/dist/general/utils/tokenBalance/tokenBalance.d.ts.map +1 -0
- package/dist/general/utils/tokenBalance/tokenBalance.js +20 -0
- package/package.json +5 -5
package/dist/app.d.ts
CHANGED
|
@@ -1664,6 +1664,31 @@ export declare function getApp(factory: Factory): import("hono/hono-base").HonoB
|
|
|
1664
1664
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
1665
1665
|
};
|
|
1666
1666
|
};
|
|
1667
|
+
} & {
|
|
1668
|
+
"/purchase/statistics": {
|
|
1669
|
+
$post: {
|
|
1670
|
+
input: {
|
|
1671
|
+
json: {
|
|
1672
|
+
platform: `0x${string}`;
|
|
1673
|
+
campaignId: string | number | bigint;
|
|
1674
|
+
walletAddress: `0x${string}`;
|
|
1675
|
+
chainId?: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId | undefined;
|
|
1676
|
+
};
|
|
1677
|
+
};
|
|
1678
|
+
output: {
|
|
1679
|
+
chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
|
|
1680
|
+
platform: `0x${string}`;
|
|
1681
|
+
campaignId: string;
|
|
1682
|
+
statistics: {
|
|
1683
|
+
priceId: string;
|
|
1684
|
+
purchases: number;
|
|
1685
|
+
fractionsSold: string;
|
|
1686
|
+
}[];
|
|
1687
|
+
};
|
|
1688
|
+
outputFormat: "json";
|
|
1689
|
+
status: 200;
|
|
1690
|
+
};
|
|
1691
|
+
};
|
|
1667
1692
|
} & {
|
|
1668
1693
|
"/withdraw/search": {
|
|
1669
1694
|
$post: {
|
|
@@ -2256,7 +2281,7 @@ export declare function getApp(factory: Factory): import("hono/hono-base").HonoB
|
|
|
2256
2281
|
decimals: number;
|
|
2257
2282
|
symbol: string;
|
|
2258
2283
|
name: string;
|
|
2259
|
-
tokenId: string;
|
|
2284
|
+
tokenId: string | null;
|
|
2260
2285
|
type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
|
|
2261
2286
|
}[];
|
|
2262
2287
|
totalItems: number;
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAUvC,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAUvC,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAUtC;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AAE7C,eAAO,MAAM,SAAS;;;CAGpB,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -2052,6 +2052,39 @@ export declare function createClient(...args: Parameters<typeof hc>): {
|
|
|
2052
2052
|
};
|
|
2053
2053
|
};
|
|
2054
2054
|
};
|
|
2055
|
+
} & {
|
|
2056
|
+
v0: {
|
|
2057
|
+
fractions: {
|
|
2058
|
+
sales: {
|
|
2059
|
+
purchase: {
|
|
2060
|
+
statistics: import("hono/client").ClientRequest<{
|
|
2061
|
+
$post: {
|
|
2062
|
+
input: {
|
|
2063
|
+
json: {
|
|
2064
|
+
platform: `0x${string}`;
|
|
2065
|
+
campaignId: string | number | bigint;
|
|
2066
|
+
walletAddress: `0x${string}`;
|
|
2067
|
+
chainId?: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId | undefined;
|
|
2068
|
+
};
|
|
2069
|
+
};
|
|
2070
|
+
output: {
|
|
2071
|
+
chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
|
|
2072
|
+
platform: `0x${string}`;
|
|
2073
|
+
campaignId: string;
|
|
2074
|
+
statistics: {
|
|
2075
|
+
priceId: string;
|
|
2076
|
+
purchases: number;
|
|
2077
|
+
fractionsSold: string;
|
|
2078
|
+
}[];
|
|
2079
|
+
};
|
|
2080
|
+
outputFormat: "json";
|
|
2081
|
+
status: 200;
|
|
2082
|
+
};
|
|
2083
|
+
}>;
|
|
2084
|
+
};
|
|
2085
|
+
};
|
|
2086
|
+
};
|
|
2087
|
+
};
|
|
2055
2088
|
} & {
|
|
2056
2089
|
v0: {
|
|
2057
2090
|
fractions: {
|
|
@@ -2755,7 +2788,7 @@ export declare function createClient(...args: Parameters<typeof hc>): {
|
|
|
2755
2788
|
decimals: number;
|
|
2756
2789
|
symbol: string;
|
|
2757
2790
|
name: string;
|
|
2758
|
-
tokenId: string;
|
|
2791
|
+
tokenId: string | null;
|
|
2759
2792
|
type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
|
|
2760
2793
|
}[];
|
|
2761
2794
|
totalItems: number;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGjC,wBAAgB,YAAY,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGjC,wBAAgB,YAAY,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE1D;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -677,6 +677,31 @@ export declare const fractionsApi: {
|
|
|
677
677
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
678
678
|
};
|
|
679
679
|
};
|
|
680
|
+
} & {
|
|
681
|
+
"/purchase/statistics": {
|
|
682
|
+
$post: {
|
|
683
|
+
input: {
|
|
684
|
+
json: {
|
|
685
|
+
platform: `0x${string}`;
|
|
686
|
+
campaignId: string | number | bigint;
|
|
687
|
+
walletAddress: `0x${string}`;
|
|
688
|
+
chainId?: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId | undefined;
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
output: {
|
|
692
|
+
chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
|
|
693
|
+
platform: `0x${string}`;
|
|
694
|
+
campaignId: string;
|
|
695
|
+
statistics: {
|
|
696
|
+
priceId: string;
|
|
697
|
+
purchases: number;
|
|
698
|
+
fractionsSold: string;
|
|
699
|
+
}[];
|
|
700
|
+
};
|
|
701
|
+
outputFormat: "json";
|
|
702
|
+
status: 200;
|
|
703
|
+
};
|
|
704
|
+
};
|
|
680
705
|
} & {
|
|
681
706
|
"/withdraw/search": {
|
|
682
707
|
$post: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fractions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fractions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAwGvC,eAAO,MAAM,YAAY;;gBAEX,CAAC,SAAS,GAAG,WAAW,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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index.js
CHANGED
|
@@ -27,6 +27,7 @@ import { createInitNidTransaction } from "./deployMarket/v0/initNid.route.js";
|
|
|
27
27
|
import { createSearchWithdrawalV0App } from "./sales/searchWithdrawal.route.js";
|
|
28
28
|
import { createSaleStatisticsV0App } from "./sales/getFractionSaleStatistics.route.js";
|
|
29
29
|
import { createSearchActivityV0App } from "./activity/searchActivity.route.js";
|
|
30
|
+
import { createPurchaseSalesStatisticsV0 } from "./purchase/v0/statistics.route.js";
|
|
30
31
|
function createPlatformsApp(factory) {
|
|
31
32
|
return factory
|
|
32
33
|
.createApp()
|
|
@@ -60,6 +61,7 @@ function createSalesApp(factory) {
|
|
|
60
61
|
.post("/complete", ...createCompleteSalesTransactionV0(factory))
|
|
61
62
|
.post("/unlockWrappedAssets", ...createUnlockWrappedAssetsTransactionV0(factory))
|
|
62
63
|
.post("/purchase", ...createPurchaseSalesTransactionV0(factory))
|
|
64
|
+
.post("/purchase/statistics", ...createPurchaseSalesStatisticsV0(factory))
|
|
63
65
|
.post("/withdraw/search", ...createSearchWithdrawalV0App(factory))
|
|
64
66
|
.post("/withdrawPaymentToken", ...createWithdrawPaymentFromSaleTransactionV0(factory))
|
|
65
67
|
.post("/receiveFundsAfterNonFunded", ...createReceiveFundsAfterNonFundedTransaction(factory))
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Env } from "hono";
|
|
2
|
+
import { Factory } from "hono/factory";
|
|
3
|
+
export declare function createPurchaseSalesStatisticsV0<E extends Env>(factory: Factory<E>): [import("hono/types").H<any, string, {}, Promise<Response & import("hono").TypedResponse<{
|
|
4
|
+
chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
|
|
5
|
+
platform: `0x${string}`;
|
|
6
|
+
campaignId: string;
|
|
7
|
+
statistics: {
|
|
8
|
+
priceId: string;
|
|
9
|
+
purchases: number;
|
|
10
|
+
fractionsSold: string;
|
|
11
|
+
}[];
|
|
12
|
+
}, 200, "json">>>, import("hono/types").H<Env, string, {
|
|
13
|
+
in: {
|
|
14
|
+
json: {
|
|
15
|
+
platform: `0x${string}`;
|
|
16
|
+
campaignId: string | number | bigint;
|
|
17
|
+
walletAddress: `0x${string}`;
|
|
18
|
+
chainId?: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
out: {
|
|
22
|
+
json: {
|
|
23
|
+
platform: `0x${string}`;
|
|
24
|
+
campaignId: bigint;
|
|
25
|
+
walletAddress: `0x${string}`;
|
|
26
|
+
chainId?: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId | undefined;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, Promise<Response & import("hono").TypedResponse<{
|
|
30
|
+
chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
|
|
31
|
+
platform: `0x${string}`;
|
|
32
|
+
campaignId: string;
|
|
33
|
+
statistics: {
|
|
34
|
+
priceId: string;
|
|
35
|
+
purchases: number;
|
|
36
|
+
fractionsSold: string;
|
|
37
|
+
}[];
|
|
38
|
+
}, 200, "json">>>, import("hono/types").H<import("hono/utils/types").IfAnyThenEmptyObject<E extends Env ? Env extends E ? {} : E : E> & {}, string, {
|
|
39
|
+
in: {
|
|
40
|
+
json: {
|
|
41
|
+
platform: `0x${string}`;
|
|
42
|
+
campaignId: string | number | bigint;
|
|
43
|
+
walletAddress: `0x${string}`;
|
|
44
|
+
chainId?: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId | undefined;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
out: {
|
|
48
|
+
json: {
|
|
49
|
+
platform: `0x${string}`;
|
|
50
|
+
campaignId: bigint;
|
|
51
|
+
walletAddress: `0x${string}`;
|
|
52
|
+
chainId?: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId | undefined;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}, Promise<Response & import("hono").TypedResponse<{
|
|
56
|
+
chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
|
|
57
|
+
platform: `0x${string}`;
|
|
58
|
+
campaignId: string;
|
|
59
|
+
statistics: {
|
|
60
|
+
priceId: string;
|
|
61
|
+
purchases: number;
|
|
62
|
+
fractionsSold: string;
|
|
63
|
+
}[];
|
|
64
|
+
}, 200, "json">>>];
|
|
65
|
+
//# sourceMappingURL=statistics.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.route.d.ts","sourceRoot":"","sources":["../../../../src/fractions/purchase/v0/statistics.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAUvC,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAiEjF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describeRoute } from "hono-openapi";
|
|
2
|
+
import { resolver, validator } from "hono-openapi/zod";
|
|
3
|
+
import { and, count, eq, sum } from "@ponder/client";
|
|
4
|
+
import { FractionsSaleStatisticSchema } from "../../sales/getFractionSaleStatistics.route.js";
|
|
5
|
+
import { AddressSchema, CampaignIdSchema, PlatformContractAddress, TmiChainIdSchema } from "../../../common/index.js";
|
|
6
|
+
import { z } from "../../../common/zod.js";
|
|
7
|
+
import { indexerSchemas } from "../../../common/indexer/schemas.js";
|
|
8
|
+
import { indexerClient } from "../../../common/indexer/index.js";
|
|
9
|
+
export function createPurchaseSalesStatisticsV0(factory) {
|
|
10
|
+
return factory.createHandlers(describeRoute({
|
|
11
|
+
summary: "Aggregate investor statistics for certain campaign",
|
|
12
|
+
description: "Returns aggregated statistics about investor purchases for a specific campaign, grouped by price ID. Statistics include the number of purchases and the total number of fractions sold.",
|
|
13
|
+
tags: ["Fractions"],
|
|
14
|
+
responses: {
|
|
15
|
+
200: {
|
|
16
|
+
description: "Aggregated purchase statistics for the specified campaign and investor.",
|
|
17
|
+
content: {
|
|
18
|
+
"application/json": {
|
|
19
|
+
schema: resolver(FractionsSaleStatisticSchema),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}), validator("json", z.object({
|
|
25
|
+
chainId: TmiChainIdSchema.optional(),
|
|
26
|
+
platform: PlatformContractAddress,
|
|
27
|
+
campaignId: CampaignIdSchema,
|
|
28
|
+
walletAddress: AddressSchema,
|
|
29
|
+
})), async (c) => {
|
|
30
|
+
const { chainId, platform, campaignId, walletAddress } = c.req.valid("json");
|
|
31
|
+
const { fractions: { fractionsPurchases }, } = indexerSchemas;
|
|
32
|
+
const rows = await indexerClient.db
|
|
33
|
+
.select({
|
|
34
|
+
purchases: count(fractionsPurchases.transactionHash),
|
|
35
|
+
fractionsSold: sum(fractionsPurchases.amountOfFractions),
|
|
36
|
+
priceId: fractionsPurchases.priceId,
|
|
37
|
+
})
|
|
38
|
+
.from(fractionsPurchases)
|
|
39
|
+
.where(and(eq(fractionsPurchases.chainId, Number(chainId)), eq(fractionsPurchases.diamondAddress, platform), eq(fractionsPurchases.saleId, BigInt(campaignId)), eq(fractionsPurchases.buyerAddress, walletAddress)))
|
|
40
|
+
.groupBy(fractionsPurchases.priceId);
|
|
41
|
+
const statistics = rows.map((r) => ({
|
|
42
|
+
...r,
|
|
43
|
+
fractionsSold: r.fractionsSold || "0",
|
|
44
|
+
}));
|
|
45
|
+
return c.json(FractionsSaleStatisticSchema.parse({
|
|
46
|
+
chainId: chainId,
|
|
47
|
+
platform: platform,
|
|
48
|
+
campaignId: campaignId,
|
|
49
|
+
statistics,
|
|
50
|
+
}), 200);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -1,71 +1,46 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
2
|
import { TmiChainId } from "@evergonlabs/tmi-protocol-fractions-sdk";
|
|
3
|
-
import {
|
|
3
|
+
import { TokenBalance } from "./utils/tokenBalance/tokenBalance.js";
|
|
4
4
|
import { z } from "../common/zod.js";
|
|
5
|
-
export declare const TokenBalance: z.ZodObject<{
|
|
6
|
-
balance: z.ZodPipeline<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodBigInt>, z.ZodString>;
|
|
7
|
-
contractAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
8
|
-
decimals: z.ZodPipeline<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodBigInt>, z.ZodNumber>;
|
|
9
|
-
id: z.ZodPipeline<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodBigInt>, z.ZodString>;
|
|
10
|
-
name: z.ZodString;
|
|
11
|
-
symbol: z.ZodString;
|
|
12
|
-
type: z.ZodEffects<z.ZodString, TokenTypeEnum | null, string>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
symbol: string;
|
|
15
|
-
type: TokenTypeEnum | null;
|
|
16
|
-
name: string;
|
|
17
|
-
decimals: number;
|
|
18
|
-
id: string;
|
|
19
|
-
contractAddress: `0x${string}`;
|
|
20
|
-
balance: string;
|
|
21
|
-
}, {
|
|
22
|
-
symbol: string;
|
|
23
|
-
type: string;
|
|
24
|
-
name: string;
|
|
25
|
-
decimals: string | number | bigint;
|
|
26
|
-
id: string | number | bigint;
|
|
27
|
-
contractAddress: `0x${string}`;
|
|
28
|
-
balance: string | number | bigint;
|
|
29
|
-
}>;
|
|
30
5
|
export declare const AccountBalancesResponse: z.ZodObject<{
|
|
31
6
|
message: z.ZodString;
|
|
32
7
|
status: z.ZodString;
|
|
33
8
|
result: z.ZodArray<z.ZodObject<{
|
|
34
|
-
balance: z.ZodPipeline<z.
|
|
35
|
-
|
|
36
|
-
decimals: z.
|
|
37
|
-
|
|
9
|
+
balance: z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>;
|
|
10
|
+
tokenAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
11
|
+
decimals: z.ZodEffects<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodNumber>, number, string | number | bigint>;
|
|
12
|
+
tokenId: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>>;
|
|
38
13
|
name: z.ZodString;
|
|
39
14
|
symbol: z.ZodString;
|
|
40
|
-
type: z.ZodEffects<z.ZodString, TokenTypeEnum | null, string>;
|
|
15
|
+
type: z.ZodEffects<z.ZodString, import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null, string>;
|
|
41
16
|
}, "strip", z.ZodTypeAny, {
|
|
42
17
|
symbol: string;
|
|
43
|
-
type: TokenTypeEnum | null;
|
|
18
|
+
type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
|
|
44
19
|
name: string;
|
|
45
20
|
decimals: number;
|
|
46
|
-
|
|
47
|
-
contractAddress: `0x${string}`;
|
|
21
|
+
tokenAddress: `0x${string}`;
|
|
48
22
|
balance: string;
|
|
23
|
+
tokenId?: string | undefined;
|
|
49
24
|
}, {
|
|
50
25
|
symbol: string;
|
|
51
26
|
type: string;
|
|
52
27
|
name: string;
|
|
53
28
|
decimals: string | number | bigint;
|
|
54
|
-
|
|
55
|
-
contractAddress: `0x${string}`;
|
|
29
|
+
tokenAddress: `0x${string}`;
|
|
56
30
|
balance: string | number | bigint;
|
|
31
|
+
tokenId?: string | number | bigint | undefined;
|
|
57
32
|
}>, "many">;
|
|
58
33
|
}, "strip", z.ZodTypeAny, {
|
|
59
34
|
status: string;
|
|
60
35
|
message: string;
|
|
61
36
|
result: {
|
|
62
37
|
symbol: string;
|
|
63
|
-
type: TokenTypeEnum | null;
|
|
38
|
+
type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
|
|
64
39
|
name: string;
|
|
65
40
|
decimals: number;
|
|
66
|
-
|
|
67
|
-
contractAddress: `0x${string}`;
|
|
41
|
+
tokenAddress: `0x${string}`;
|
|
68
42
|
balance: string;
|
|
43
|
+
tokenId?: string | undefined;
|
|
69
44
|
}[];
|
|
70
45
|
}, {
|
|
71
46
|
status: string;
|
|
@@ -75,9 +50,9 @@ export declare const AccountBalancesResponse: z.ZodObject<{
|
|
|
75
50
|
type: string;
|
|
76
51
|
name: string;
|
|
77
52
|
decimals: string | number | bigint;
|
|
78
|
-
|
|
79
|
-
contractAddress: `0x${string}`;
|
|
53
|
+
tokenAddress: `0x${string}`;
|
|
80
54
|
balance: string | number | bigint;
|
|
55
|
+
tokenId?: string | number | bigint | undefined;
|
|
81
56
|
}[];
|
|
82
57
|
}>;
|
|
83
58
|
export declare function getAccountBalances(wallet: Address, chainId: TmiChainId): Promise<z.infer<typeof TokenBalance>[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balanceClient.d.ts","sourceRoot":"","sources":["../../src/general/balanceClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"balanceClient.d.ts","sourceRoot":"","sources":["../../src/general/balanceClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAErC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AAEH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,EAAE,CAAC,CAkBzC"}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { TokenTypeEnum } from "@evergonlabs/tmi-protocol-types/evm";
|
|
3
|
-
import { Int256 } from "@evergonlabs/tmi-utils/models";
|
|
4
2
|
import { getBalancesApi } from "../common/blockchain.js";
|
|
5
|
-
import {
|
|
3
|
+
import { TokenBalance } from "./utils/tokenBalance/tokenBalance.js";
|
|
6
4
|
import { z } from "../common/zod.js";
|
|
7
|
-
const tokenTypeDict = {
|
|
8
|
-
"ERC-721": TokenTypeEnum.ERC721,
|
|
9
|
-
"ERC-1155": TokenTypeEnum.ERC1155,
|
|
10
|
-
"ERC-20": TokenTypeEnum.ERC20,
|
|
11
|
-
};
|
|
12
|
-
// @see definitions here https://docs.blockscout.com/devs/apis/rpc/account#get-list-of-tokens-owned-by-address
|
|
13
|
-
export const TokenBalance = z.object({
|
|
14
|
-
balance: Int256.pipe(z.string()),
|
|
15
|
-
contractAddress: AddressSchema,
|
|
16
|
-
decimals: Int256.pipe(z.number()),
|
|
17
|
-
id: Int256.pipe(z.string()),
|
|
18
|
-
name: z.string(),
|
|
19
|
-
symbol: z.string(),
|
|
20
|
-
type: z.string().transform((x) => (x in tokenTypeDict ? tokenTypeDict[x] : null)),
|
|
21
|
-
});
|
|
22
5
|
export const AccountBalancesResponse = z.object({
|
|
23
6
|
message: z.string(),
|
|
24
7
|
status: z.string(),
|
package/dist/general/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function createSearchBalancesV0<E extends Env, TTag extends ITag>
|
|
|
8
8
|
decimals: number;
|
|
9
9
|
symbol: string;
|
|
10
10
|
name: string;
|
|
11
|
-
tokenId: string;
|
|
11
|
+
tokenId: string | null;
|
|
12
12
|
type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
|
|
13
13
|
}[];
|
|
14
14
|
totalItems: number;
|
|
@@ -34,7 +34,7 @@ export declare function createSearchBalancesV0<E extends Env, TTag extends ITag>
|
|
|
34
34
|
decimals: number;
|
|
35
35
|
symbol: string;
|
|
36
36
|
name: string;
|
|
37
|
-
tokenId: string;
|
|
37
|
+
tokenId: string | null;
|
|
38
38
|
type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
|
|
39
39
|
}[];
|
|
40
40
|
totalItems: number;
|
|
@@ -60,7 +60,7 @@ export declare function createSearchBalancesV0<E extends Env, TTag extends ITag>
|
|
|
60
60
|
decimals: number;
|
|
61
61
|
symbol: string;
|
|
62
62
|
name: string;
|
|
63
|
-
tokenId: string;
|
|
63
|
+
tokenId: string | null;
|
|
64
64
|
type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
|
|
65
65
|
}[];
|
|
66
66
|
totalItems: number;
|
|
@@ -29,12 +29,12 @@ export function createSearchBalancesV0(factory, tag) {
|
|
|
29
29
|
const result = await getAccountBalances(address, chainId);
|
|
30
30
|
return c.json({
|
|
31
31
|
balances: result.map((x) => ({
|
|
32
|
-
tokenAddress: x.
|
|
32
|
+
tokenAddress: x.tokenAddress,
|
|
33
33
|
balance: x.balance,
|
|
34
34
|
decimals: x.decimals,
|
|
35
35
|
symbol: x.symbol,
|
|
36
36
|
name: x.name,
|
|
37
|
-
tokenId: x.
|
|
37
|
+
tokenId: x.tokenId ?? null,
|
|
38
38
|
type: x.type,
|
|
39
39
|
})),
|
|
40
40
|
totalItems: result.length,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TokenTypeEnum } from "@evergonlabs/tmi-protocol-types/evm";
|
|
2
|
+
import { z } from "../../../common/zod.js";
|
|
3
|
+
export declare const TokenBalance: z.ZodObject<{
|
|
4
|
+
balance: z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>;
|
|
5
|
+
tokenAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
6
|
+
decimals: z.ZodEffects<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodNumber>, number, string | number | bigint>;
|
|
7
|
+
tokenId: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>>;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
symbol: z.ZodString;
|
|
10
|
+
type: z.ZodEffects<z.ZodString, TokenTypeEnum | null, string>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
symbol: string;
|
|
13
|
+
type: TokenTypeEnum | null;
|
|
14
|
+
name: string;
|
|
15
|
+
decimals: number;
|
|
16
|
+
tokenAddress: `0x${string}`;
|
|
17
|
+
balance: string;
|
|
18
|
+
tokenId?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
symbol: string;
|
|
21
|
+
type: string;
|
|
22
|
+
name: string;
|
|
23
|
+
decimals: string | number | bigint;
|
|
24
|
+
tokenAddress: `0x${string}`;
|
|
25
|
+
balance: string | number | bigint;
|
|
26
|
+
tokenId?: string | number | bigint | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
//# sourceMappingURL=tokenBalance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenBalance.d.ts","sourceRoot":"","sources":["../../../../src/general/utils/tokenBalance/tokenBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAW3C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;EASvB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TokenTypeEnum } from "@evergonlabs/tmi-protocol-types/evm";
|
|
2
|
+
import { AddressSchema } from "../../../common/index.js";
|
|
3
|
+
import { z } from "../../../common/zod.js";
|
|
4
|
+
import { NumberishSchema } from "@evergonlabs/tmi-protocol-types/common";
|
|
5
|
+
const tokenTypeDict = {
|
|
6
|
+
"ERC-721": TokenTypeEnum.ERC721,
|
|
7
|
+
"ERC-1155": TokenTypeEnum.ERC1155,
|
|
8
|
+
"ERC-20": TokenTypeEnum.ERC20,
|
|
9
|
+
};
|
|
10
|
+
// @see definitions here https://docs.blockscout.com/devs/apis/rpc/account#get-list-of-tokens-owned-by-address
|
|
11
|
+
export const TokenBalance = z.object({
|
|
12
|
+
balance: NumberishSchema.pipe(z.string()),
|
|
13
|
+
tokenAddress: AddressSchema,
|
|
14
|
+
// ERC-721 and ERC-1155 has no decimals but for interoperability we return 1
|
|
15
|
+
decimals: NumberishSchema.pipe(z.coerce.number()).transform((x) => x || 1),
|
|
16
|
+
tokenId: z.optional(NumberishSchema.pipe(z.string())),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
symbol: z.string(),
|
|
19
|
+
type: z.string().transform((x) => (x in tokenTypeDict ? tokenTypeDict[x] : null)),
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evergonlabs/tmi-protocol-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"zod": "^3.25.0",
|
|
39
39
|
"zod-openapi": "^4.2.4",
|
|
40
40
|
"@evergonlabs/tmi-protocol-fractions-sdk": "0.2.0",
|
|
41
|
-
"@evergonlabs/tmi-protocol-types": "0.2.0",
|
|
42
|
-
"@evergonlabs/tmi-protocol-utils": "0.2.0",
|
|
43
|
-
"@evergonlabs/tmi-protocol-staking-sdk": "0.2.0",
|
|
44
41
|
"@evergonlabs/tmi-protocol-indexer": "0.1.0",
|
|
45
|
-
"@evergonlabs/tmi-protocol-shared": "0.1.0"
|
|
42
|
+
"@evergonlabs/tmi-protocol-shared": "0.1.0",
|
|
43
|
+
"@evergonlabs/tmi-protocol-staking-sdk": "0.2.0",
|
|
44
|
+
"@evergonlabs/tmi-protocol-types": "0.2.0",
|
|
45
|
+
"@evergonlabs/tmi-protocol-utils": "0.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@evergonlabs/tmi-eslint-config": "^0.1.3",
|