@longdotxyz/shared 0.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.
- package/dist/contracts/auction.contract.d.ts +294 -0
- package/dist/contracts/auction.contract.js +73 -0
- package/dist/contracts/auction.contract.js.map +1 -0
- package/dist/contracts/community.contract.d.ts +116 -0
- package/dist/contracts/community.contract.js +39 -0
- package/dist/contracts/community.contract.js.map +1 -0
- package/dist/contracts/index.d.ts +525 -0
- package/dist/contracts/index.js +34 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/ipfs.contract.d.ts +86 -0
- package/dist/contracts/ipfs.contract.js +44 -0
- package/dist/contracts/ipfs.contract.js.map +1 -0
- package/dist/contracts/quote.contract.d.ts +121 -0
- package/dist/contracts/quote.contract.js +54 -0
- package/dist/contracts/quote.contract.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/types/bigint.type.d.ts +2 -0
- package/dist/types/bigint.type.js +19 -0
- package/dist/types/bigint.type.js.map +1 -0
- package/dist/types/hex.type.d.ts +3 -0
- package/dist/types/hex.type.js +9 -0
- package/dist/types/hex.type.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +20 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/pool-key.type.d.ts +8 -0
- package/dist/types/pool-key.type.js +3 -0
- package/dist/types/pool-key.type.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/native-token.util.d.ts +5 -0
- package/dist/utils/native-token.util.js +26 -0
- package/dist/utils/native-token.util.js.map +1 -0
- package/package.json +47 -0
- package/readme.md +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ipfsContract = void 0;
|
|
4
|
+
const core_1 = require("@ts-rest/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const contract = (0, core_1.initContract)();
|
|
7
|
+
const ipfsContract = contract.router({
|
|
8
|
+
uploadImage: {
|
|
9
|
+
path: "/ipfs/upload-image",
|
|
10
|
+
method: "POST",
|
|
11
|
+
contentType: "multipart/form-data",
|
|
12
|
+
body: contract.type(),
|
|
13
|
+
responses: {
|
|
14
|
+
200: zod_1.default.object({
|
|
15
|
+
result: zod_1.default.string(),
|
|
16
|
+
}),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
uploadMetadata: {
|
|
20
|
+
path: "/ipfs/upload-metadata",
|
|
21
|
+
method: "POST",
|
|
22
|
+
body: zod_1.default.object({
|
|
23
|
+
name: zod_1.default.string(),
|
|
24
|
+
description: zod_1.default.string(),
|
|
25
|
+
image_hash: zod_1.default.string(),
|
|
26
|
+
social_links: zod_1.default.array(zod_1.default.object({
|
|
27
|
+
label: zod_1.default.string(),
|
|
28
|
+
url: zod_1.default.string(),
|
|
29
|
+
})),
|
|
30
|
+
vesting_recipients: zod_1.default.array(zod_1.default.object({
|
|
31
|
+
address: zod_1.default.string(),
|
|
32
|
+
percentage: zod_1.default.number(),
|
|
33
|
+
})),
|
|
34
|
+
fee_receiver: zod_1.default.string(),
|
|
35
|
+
}),
|
|
36
|
+
responses: {
|
|
37
|
+
200: zod_1.default.object({
|
|
38
|
+
result: zod_1.default.string(),
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
exports.ipfsContract = ipfsContract;
|
|
44
|
+
//# sourceMappingURL=ipfs.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipfs.contract.js","sourceRoot":"","sources":["../../src/contracts/ipfs.contract.ts"],"names":[],"mappings":";;;AAAA,wCAA6C;AAC7C,6BAAoB;AAEpB,MAAM,QAAQ,GAAG,IAAA,mBAAY,GAAE,CAAC;AAEhC,MAAM,YAAY,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
|
+
chainId: z.ZodNumber;
|
|
7
|
+
tokenIn: z.ZodPipeline<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
8
|
+
tokenOut: z.ZodPipeline<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
9
|
+
amountOut: z.ZodEffects<z.ZodAny, bigint, any>;
|
|
10
|
+
fee: z.ZodNumber;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
chainId: number;
|
|
13
|
+
tokenIn: `0x${string}`;
|
|
14
|
+
tokenOut: `0x${string}`;
|
|
15
|
+
amountOut: bigint;
|
|
16
|
+
fee: number;
|
|
17
|
+
}, {
|
|
18
|
+
chainId: number;
|
|
19
|
+
tokenIn: string;
|
|
20
|
+
tokenOut: string;
|
|
21
|
+
fee: number;
|
|
22
|
+
amountOut?: any;
|
|
23
|
+
}>;
|
|
24
|
+
path: "/v3/exact-output-single";
|
|
25
|
+
responses: {
|
|
26
|
+
200: z.ZodObject<{
|
|
27
|
+
result: z.ZodObject<{
|
|
28
|
+
amountIn: z.ZodString;
|
|
29
|
+
sqrtPriceX96After: z.ZodString;
|
|
30
|
+
initializedTicksCrossed: z.ZodNumber;
|
|
31
|
+
gasEstimate: z.ZodString;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
amountIn: string;
|
|
34
|
+
sqrtPriceX96After: string;
|
|
35
|
+
initializedTicksCrossed: number;
|
|
36
|
+
gasEstimate: string;
|
|
37
|
+
}, {
|
|
38
|
+
amountIn: string;
|
|
39
|
+
sqrtPriceX96After: string;
|
|
40
|
+
initializedTicksCrossed: number;
|
|
41
|
+
gasEstimate: string;
|
|
42
|
+
}>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
result: {
|
|
45
|
+
amountIn: string;
|
|
46
|
+
sqrtPriceX96After: string;
|
|
47
|
+
initializedTicksCrossed: number;
|
|
48
|
+
gasEstimate: string;
|
|
49
|
+
};
|
|
50
|
+
}, {
|
|
51
|
+
result: {
|
|
52
|
+
amountIn: string;
|
|
53
|
+
sqrtPriceX96After: string;
|
|
54
|
+
initializedTicksCrossed: number;
|
|
55
|
+
gasEstimate: string;
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
v3ExactInputSingle: {
|
|
61
|
+
method: "POST";
|
|
62
|
+
body: z.ZodObject<{
|
|
63
|
+
chainId: z.ZodNumber;
|
|
64
|
+
tokenIn: z.ZodPipeline<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
65
|
+
tokenOut: z.ZodPipeline<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
66
|
+
amountIn: z.ZodEffects<z.ZodAny, bigint, any>;
|
|
67
|
+
fee: z.ZodNumber;
|
|
68
|
+
sqrtPriceLimitX96: z.ZodOptional<z.ZodEffects<z.ZodAny, bigint, any>>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
chainId: number;
|
|
71
|
+
tokenIn: `0x${string}`;
|
|
72
|
+
tokenOut: `0x${string}`;
|
|
73
|
+
fee: number;
|
|
74
|
+
amountIn: bigint;
|
|
75
|
+
sqrtPriceLimitX96?: bigint | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
chainId: number;
|
|
78
|
+
tokenIn: string;
|
|
79
|
+
tokenOut: string;
|
|
80
|
+
fee: number;
|
|
81
|
+
amountIn?: any;
|
|
82
|
+
sqrtPriceLimitX96?: any;
|
|
83
|
+
}>;
|
|
84
|
+
path: "/v3/exact-input-single";
|
|
85
|
+
responses: {
|
|
86
|
+
200: z.ZodObject<{
|
|
87
|
+
result: z.ZodObject<{
|
|
88
|
+
amountOut: z.ZodString;
|
|
89
|
+
sqrtPriceX96After: z.ZodString;
|
|
90
|
+
initializedTicksCrossed: z.ZodNumber;
|
|
91
|
+
gasEstimate: z.ZodString;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
amountOut: string;
|
|
94
|
+
sqrtPriceX96After: string;
|
|
95
|
+
initializedTicksCrossed: number;
|
|
96
|
+
gasEstimate: string;
|
|
97
|
+
}, {
|
|
98
|
+
amountOut: string;
|
|
99
|
+
sqrtPriceX96After: string;
|
|
100
|
+
initializedTicksCrossed: number;
|
|
101
|
+
gasEstimate: string;
|
|
102
|
+
}>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
result: {
|
|
105
|
+
amountOut: string;
|
|
106
|
+
sqrtPriceX96After: string;
|
|
107
|
+
initializedTicksCrossed: number;
|
|
108
|
+
gasEstimate: string;
|
|
109
|
+
};
|
|
110
|
+
}, {
|
|
111
|
+
result: {
|
|
112
|
+
amountOut: string;
|
|
113
|
+
sqrtPriceX96After: string;
|
|
114
|
+
initializedTicksCrossed: number;
|
|
115
|
+
gasEstimate: string;
|
|
116
|
+
};
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
export { quoteContract };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.quoteContract = void 0;
|
|
4
|
+
const core_1 = require("@ts-rest/core");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const contract = (0, core_1.initContract)();
|
|
8
|
+
const quoteContract = contract.router({
|
|
9
|
+
v3ExactOutputSingle: {
|
|
10
|
+
method: "POST",
|
|
11
|
+
path: "/v3/exact-output-single",
|
|
12
|
+
body: zod_1.default.object({
|
|
13
|
+
chainId: zod_1.default.number(),
|
|
14
|
+
tokenIn: zod_1.default.string().pipe(types_1.hex),
|
|
15
|
+
tokenOut: zod_1.default.string().pipe(types_1.hex),
|
|
16
|
+
amountOut: types_1.coerceBigInt,
|
|
17
|
+
fee: zod_1.default.number(),
|
|
18
|
+
}),
|
|
19
|
+
responses: {
|
|
20
|
+
200: zod_1.default.object({
|
|
21
|
+
result: zod_1.default.object({
|
|
22
|
+
amountIn: zod_1.default.string(),
|
|
23
|
+
sqrtPriceX96After: zod_1.default.string(),
|
|
24
|
+
initializedTicksCrossed: zod_1.default.number(),
|
|
25
|
+
gasEstimate: zod_1.default.string(),
|
|
26
|
+
}),
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
v3ExactInputSingle: {
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/v3/exact-input-single",
|
|
33
|
+
body: zod_1.default.object({
|
|
34
|
+
chainId: zod_1.default.number(),
|
|
35
|
+
tokenIn: zod_1.default.string().pipe(types_1.hex),
|
|
36
|
+
tokenOut: zod_1.default.string().pipe(types_1.hex),
|
|
37
|
+
amountIn: types_1.coerceBigInt,
|
|
38
|
+
fee: zod_1.default.number(),
|
|
39
|
+
sqrtPriceLimitX96: zod_1.default.optional(types_1.coerceBigInt),
|
|
40
|
+
}),
|
|
41
|
+
responses: {
|
|
42
|
+
200: zod_1.default.object({
|
|
43
|
+
result: zod_1.default.object({
|
|
44
|
+
amountOut: zod_1.default.string(),
|
|
45
|
+
sqrtPriceX96After: zod_1.default.string(),
|
|
46
|
+
initializedTicksCrossed: zod_1.default.number(),
|
|
47
|
+
gasEstimate: zod_1.default.string(),
|
|
48
|
+
}),
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
exports.quoteContract = quoteContract;
|
|
54
|
+
//# sourceMappingURL=quote.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.contract.js","sourceRoot":"","sources":["../../src/contracts/quote.contract.ts"],"names":[],"mappings":";;;AAAA,wCAA6C;AAC7C,6BAAoB;AAEpB,oCAA6C;AAE7C,MAAM,QAAQ,GAAG,IAAA,mBAAY,GAAE,CAAC;AAEhC,MAAM,aAAa,GAAG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,EAAE,aAAC,CAAC,MAAM,CAAC;oBACb,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;oBACrB,iBAAiB,EAAE,aAAC,CAAC,MAAM,EAAE;oBAC7B,uBAAuB,EAAE,aAAC,CAAC,MAAM,EAAE;oBACnC,WAAW,EAAE,aAAC,CAAC,MAAM,EAAE;iBAC1B,CAAC;aACL,CAAC;SACL;KACJ;CACJ,CAAC,CAAC;AAEM,sCAAa"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./contracts"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./utils"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAwB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coerceBigInt = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.coerceBigInt = zod_1.default.any().transform((value, ctx) => {
|
|
6
|
+
try {
|
|
7
|
+
return BigInt(value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
ctx.addIssue({
|
|
11
|
+
code: "invalid_type",
|
|
12
|
+
expected: "unknown",
|
|
13
|
+
received: value,
|
|
14
|
+
message: `Can't be parsed to BigInt`,
|
|
15
|
+
});
|
|
16
|
+
return zod_1.default.NEVER;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=bigint.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bigint.type.js","sourceRoot":"","sources":["../../src/types/bigint.type.ts"],"names":[],"mappings":";;;AAAA,6BAAoB;AAEP,QAAA,YAAY,GAAG,aAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACzD,IAAI,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,GAAG,CAAC,QAAQ,CAAC;YACT,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,2BAA2B;SACvC,CAAC,CAAC;QACH,OAAO,aAAC,CAAC,KAAK,CAAC;IACnB,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hex = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const hex = zod_1.default.custom((value) => {
|
|
6
|
+
return typeof value === "string" && value.startsWith("0x");
|
|
7
|
+
});
|
|
8
|
+
exports.hex = hex;
|
|
9
|
+
//# sourceMappingURL=hex.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.type.js","sourceRoot":"","sources":["../../src/types/hex.type.ts"],"names":[],"mappings":";;;AACA,6BAAoB;AAEpB,MAAM,GAAG,GAAG,aAAC,CAAC,MAAM,CAAM,CAAC,KAAK,EAAE,EAAE;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEM,kBAAG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bigint.type"), exports);
|
|
18
|
+
__exportStar(require("./hex.type"), exports);
|
|
19
|
+
__exportStar(require("./pool-key.type"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B;AAC3B,kDAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool-key.type.js","sourceRoot":"","sources":["../../src/types/pool-key.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./native-token.util";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./native-token.util"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WETH_ADDRESSES = exports.NATIVE_ETH_ADDRESS = void 0;
|
|
4
|
+
exports.getWETHAddress = getWETHAddress;
|
|
5
|
+
exports.isNativeETH = isNativeETH;
|
|
6
|
+
exports.NATIVE_ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
7
|
+
exports.WETH_ADDRESSES = {
|
|
8
|
+
1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
9
|
+
8453: "0x4200000000000000000000000000000000000006",
|
|
10
|
+
10: "0x4200000000000000000000000000000000000006",
|
|
11
|
+
42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
12
|
+
137: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
|
|
13
|
+
56: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
|
|
14
|
+
43114: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
|
|
15
|
+
};
|
|
16
|
+
function getWETHAddress(chainId) {
|
|
17
|
+
const weth = exports.WETH_ADDRESSES[chainId];
|
|
18
|
+
if (!weth) {
|
|
19
|
+
throw new Error(`WETH address not configured for chain ${chainId}`);
|
|
20
|
+
}
|
|
21
|
+
return weth;
|
|
22
|
+
}
|
|
23
|
+
function isNativeETH(address) {
|
|
24
|
+
return address.toLowerCase() === exports.NATIVE_ETH_ADDRESS.toLowerCase();
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=native-token.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-token.util.js","sourceRoot":"","sources":["../../src/utils/native-token.util.ts"],"names":[],"mappings":";;;AAcA,wCAMC;AAED,kCAEC;AAtBY,QAAA,kBAAkB,GAAG,4CAAmD,CAAC;AAEzE,QAAA,cAAc,GAAwB;IAC/C,CAAC,EAAE,4CAA4C;IAC/C,IAAI,EAAE,4CAA4C;IAClD,EAAE,EAAE,4CAA4C;IAChD,KAAK,EAAE,4CAA4C;IACnD,GAAG,EAAE,4CAA4C;IACjD,EAAE,EAAE,4CAA4C;IAChD,KAAK,EAAE,4CAA4C;CAC7C,CAAC;AAEX,SAAgB,cAAc,CAAC,OAAe;IAC1C,MAAM,IAAI,GAAG,sBAAc,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,yCAAyC,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAgB,WAAW,CAAC,OAAe;IACvC,OAAO,OAAO,CAAC,WAAW,EAAE,KAAK,0BAAkB,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@longdotxyz/shared",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Shared types and utilities for Long.xyz API",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"private": false,
|
|
11
|
+
"license": "UNLICENSED",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"viem": "^2.37.5"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"zod": "^3.25.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^5.7.3"
|
|
20
|
+
},
|
|
21
|
+
"jest": {
|
|
22
|
+
"moduleFileExtensions": [
|
|
23
|
+
"js",
|
|
24
|
+
"json",
|
|
25
|
+
"ts"
|
|
26
|
+
],
|
|
27
|
+
"rootDir": "src",
|
|
28
|
+
"testRegex": ".*\\.*spec*\\.ts$",
|
|
29
|
+
"transform": {
|
|
30
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
31
|
+
},
|
|
32
|
+
"collectCoverageFrom": [
|
|
33
|
+
"**/*.(t|j)s"
|
|
34
|
+
],
|
|
35
|
+
"coverageDirectory": "../coverage",
|
|
36
|
+
"testEnvironment": "node"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "rm -f tsconfig.tsbuildinfo && tsc",
|
|
40
|
+
"build:watch": "tsc --watch",
|
|
41
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
42
|
+
"lint": "eslint \"src/**/*.ts\" --fix",
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"test:watch": "jest --watch",
|
|
45
|
+
"test:cov": "jest --coverage"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Long.xyz Platform Shared Library
|