defi-kit 0.1.12
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/chunk-CS4FH2KK.mjs +64 -0
- package/dist/chunk-CS4FH2KK.mjs.map +1 -0
- package/dist/chunk-VQMEUJ4S.mjs +15080 -0
- package/dist/chunk-VQMEUJ4S.mjs.map +1 -0
- package/dist/eth.d.ts +33 -0
- package/dist/eth.js +15122 -0
- package/dist/eth.js.map +1 -0
- package/dist/eth.mjs +18 -0
- package/dist/eth.mjs.map +1 -0
- package/dist/gor.d.ts +33 -0
- package/dist/gor.js +13952 -0
- package/dist/gor.js.map +1 -0
- package/dist/gor.mjs +18 -0
- package/dist/gor.mjs.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +26 -0
- package/dist/index.mjs.map +1 -0
- package/dist/schema-ad08d8ab.d.ts +314 -0
- package/package.json +72 -0
package/dist/gor.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApply,
|
|
3
|
+
createExportJson,
|
|
4
|
+
gor,
|
|
5
|
+
gor2
|
|
6
|
+
} from "./chunk-VQMEUJ4S.mjs";
|
|
7
|
+
import "./chunk-CS4FH2KK.mjs";
|
|
8
|
+
|
|
9
|
+
// src/gor.ts
|
|
10
|
+
var apply = createApply(5);
|
|
11
|
+
var exportJson = createExportJson(5);
|
|
12
|
+
export {
|
|
13
|
+
gor as allow,
|
|
14
|
+
apply,
|
|
15
|
+
exportJson,
|
|
16
|
+
gor2 as schema
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=gor.mjs.map
|
package/dist/gor.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/gor.ts"],"sourcesContent":["import { gor as allow } from \"./protocols\"\nimport { gor as schema } from \"./protocols/schema\"\n\nimport { createApply } from \"./apply\"\nimport { createExportJson } from \"./json\"\n\nexport { allow, schema }\n\nexport const apply = createApply(5)\nexport const exportJson = createExportJson(5)\n"],"mappings":";;;;;;;;;AAQO,IAAM,QAAQ,YAAY,CAAC;AAC3B,IAAM,aAAa,iBAAiB,CAAC;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { formatBytes32String, parseBytes32String } from 'ethers/lib/utils';
|
|
2
|
+
import { z, SomeZodObject } from 'zod';
|
|
3
|
+
import { PresetAllowEntry } from 'zodiac-roles-sdk';
|
|
4
|
+
|
|
5
|
+
declare class NotFoundError extends Error {
|
|
6
|
+
}
|
|
7
|
+
declare class MintPaused extends Error {
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const encodeBytes32String: typeof formatBytes32String;
|
|
11
|
+
declare const decodeBytes32String: typeof parseBytes32String;
|
|
12
|
+
|
|
13
|
+
declare const zx: {
|
|
14
|
+
address: () => z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type Action = "deposit" | "borrow" | "stake" | "claim" | "swap";
|
|
18
|
+
declare enum Chain {
|
|
19
|
+
eth = "eth",
|
|
20
|
+
gor = "gor"
|
|
21
|
+
}
|
|
22
|
+
interface DepositOptions {
|
|
23
|
+
/** The deposit target, an AMM pool, specific money market identified by either name or address */
|
|
24
|
+
targets: any[];
|
|
25
|
+
/** A list of tokens that can be deposited, identified by symbol or address. If not set all tokens of the pool are allowed. */
|
|
26
|
+
tokens?: any[];
|
|
27
|
+
}
|
|
28
|
+
interface BorrowOptions {
|
|
29
|
+
/** The tokens that can be borrowed */
|
|
30
|
+
tokens: any[];
|
|
31
|
+
}
|
|
32
|
+
interface StakeOptions {
|
|
33
|
+
targets: any[];
|
|
34
|
+
}
|
|
35
|
+
interface ClaimOptions {
|
|
36
|
+
}
|
|
37
|
+
type SwapOptions = {
|
|
38
|
+
/** List of tokens that can be sold, identified by symbol or address. */
|
|
39
|
+
sell: any[];
|
|
40
|
+
/** List of tokens that can be bought, identified by symbol or address. */
|
|
41
|
+
buy: any[];
|
|
42
|
+
/** List of pools that can be used, identified by name or address. If not set it will generate permissions for all pools containing any pair of the sell and buy tokens. */
|
|
43
|
+
pools?: any[];
|
|
44
|
+
} | {
|
|
45
|
+
/** List of tokens that can be sold, identified by symbol or address. If not set all tokens in the listed pools can be sold. */
|
|
46
|
+
sell?: any[];
|
|
47
|
+
/** List of tokens that can be bought, identified by symbol or address. If not set all tokens in the listed pools can be bought. */
|
|
48
|
+
buy?: any[];
|
|
49
|
+
/** List of pools that can be used, identified by name or address. */
|
|
50
|
+
pools: any[];
|
|
51
|
+
};
|
|
52
|
+
type ProtocolActions = {
|
|
53
|
+
deposit?: (options: DepositOptions) => PresetAllowEntry[];
|
|
54
|
+
borrow?: (options: BorrowOptions) => PresetAllowEntry[];
|
|
55
|
+
stake?: (options: StakeOptions) => PresetAllowEntry[];
|
|
56
|
+
claim?: (options: ClaimOptions) => PresetAllowEntry[];
|
|
57
|
+
swap?: (options: SwapOptions) => PresetAllowEntry[];
|
|
58
|
+
};
|
|
59
|
+
type ProtocolSchemas = {
|
|
60
|
+
deposit?: SomeZodObject;
|
|
61
|
+
borrow?: SomeZodObject;
|
|
62
|
+
stake?: SomeZodObject;
|
|
63
|
+
claim?: SomeZodObject;
|
|
64
|
+
swap?: SomeZodObject;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { Action, Chain, MintPaused, NotFoundError, ProtocolActions, ProtocolSchemas, decodeBytes32String, encodeBytes32String, zx };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Chain: () => Chain,
|
|
24
|
+
MintPaused: () => MintPaused,
|
|
25
|
+
NotFoundError: () => NotFoundError,
|
|
26
|
+
decodeBytes32String: () => decodeBytes32String,
|
|
27
|
+
encodeBytes32String: () => encodeBytes32String,
|
|
28
|
+
zx: () => zx
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
|
|
32
|
+
// src/errors.ts
|
|
33
|
+
var NotFoundError = class extends Error {
|
|
34
|
+
};
|
|
35
|
+
var MintPaused = class extends Error {
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/encode.ts
|
|
39
|
+
var import_utils = require("ethers/lib/utils");
|
|
40
|
+
var encodeBytes32String = import_utils.formatBytes32String;
|
|
41
|
+
var decodeBytes32String = import_utils.parseBytes32String;
|
|
42
|
+
|
|
43
|
+
// src/zx.ts
|
|
44
|
+
var import_utils2 = require("ethers/lib/utils");
|
|
45
|
+
var import_zod = require("zod");
|
|
46
|
+
var import_zod_to_openapi = require("@asteasolutions/zod-to-openapi");
|
|
47
|
+
(0, import_zod_to_openapi.extendZodWithOpenApi)(import_zod.z);
|
|
48
|
+
var zx = {
|
|
49
|
+
address: () => import_zod.z.string().transform((val, ctx) => {
|
|
50
|
+
try {
|
|
51
|
+
return (0, import_utils2.getAddress)(val);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
ctx.addIssue({
|
|
54
|
+
code: import_zod.z.ZodIssueCode.custom,
|
|
55
|
+
message: "Address checksum is invalid"
|
|
56
|
+
});
|
|
57
|
+
return import_zod.z.NEVER;
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/types.ts
|
|
63
|
+
var Chain = /* @__PURE__ */ ((Chain2) => {
|
|
64
|
+
Chain2["eth"] = "eth";
|
|
65
|
+
Chain2["gor"] = "gor";
|
|
66
|
+
return Chain2;
|
|
67
|
+
})(Chain || {});
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
Chain,
|
|
71
|
+
MintPaused,
|
|
72
|
+
NotFoundError,
|
|
73
|
+
decodeBytes32String,
|
|
74
|
+
encodeBytes32String,
|
|
75
|
+
zx
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/encode.ts","../src/zx.ts","../src/types.ts"],"sourcesContent":["export * from \"./errors\"\nexport * from \"./encode\"\nexport * from \"./zx\"\nexport * from \"./types\"\n","export class NotFoundError extends Error {}\nexport class MintPaused extends Error {}\n","import { formatBytes32String, parseBytes32String } from \"ethers/lib/utils\"\n\nexport const encodeBytes32String = formatBytes32String\nexport const decodeBytes32String = parseBytes32String\n","import { getAddress } from \"ethers/lib/utils\"\nimport { z } from \"zod\"\nimport { extendZodWithOpenApi } from \"@asteasolutions/zod-to-openapi\"\n\n// zx = \"zod extension\", providing custom zod types\n\nextendZodWithOpenApi(z)\n\nconst ADDRESS = /^0x[0-9a-fA-F]{40}$/\n\nexport const zx = {\n address: () =>\n z.string().transform((val, ctx) => {\n try {\n return getAddress(val) as `0x${string}`\n } catch (e) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"Address checksum is invalid\",\n })\n return z.NEVER\n }\n }),\n}\n","import { SomeZodObject } from \"zod\"\nimport { PresetAllowEntry } from \"zodiac-roles-sdk\"\n\nexport type Action = \"deposit\" | \"borrow\" | \"stake\" | \"claim\" | \"swap\"\n\nexport enum Chain {\n eth = \"eth\",\n gor = \"gor\",\n}\n\ninterface DepositOptions {\n /** The deposit target, an AMM pool, specific money market identified by either name or address */\n targets: any[]\n\n /** A list of tokens that can be deposited, identified by symbol or address. If not set all tokens of the pool are allowed. */\n tokens?: any[]\n}\n\ninterface BorrowOptions {\n /** The tokens that can be borrowed */\n tokens: any[]\n}\n\ninterface StakeOptions {\n targets: any[]\n}\n\ninterface ClaimOptions {}\n\ntype SwapOptions =\n | {\n /** List of tokens that can be sold, identified by symbol or address. */\n sell: any[]\n /** List of tokens that can be bought, identified by symbol or address. */\n buy: any[]\n /** List of pools that can be used, identified by name or address. If not set it will generate permissions for all pools containing any pair of the sell and buy tokens. */\n pools?: any[]\n }\n | {\n /** List of tokens that can be sold, identified by symbol or address. If not set all tokens in the listed pools can be sold. */\n sell?: any[]\n /** List of tokens that can be bought, identified by symbol or address. If not set all tokens in the listed pools can be bought. */\n buy?: any[]\n /** List of pools that can be used, identified by name or address. */\n pools: any[]\n }\n\n// These types define the common interface for actions across all protocols\nexport type ProtocolActions = {\n deposit?: (options: DepositOptions) => PresetAllowEntry[]\n\n borrow?: (options: BorrowOptions) => PresetAllowEntry[]\n\n stake?: (options: StakeOptions) => PresetAllowEntry[]\n\n // TODO do we wanna keep this as a standard action\n claim?: (options: ClaimOptions) => PresetAllowEntry[]\n\n swap?: (options: SwapOptions) => PresetAllowEntry[]\n}\n\n// For registering protocols in the REST API we need zod schemas for the specific parameters of each action\nexport type ProtocolSchemas = {\n deposit?: SomeZodObject\n borrow?: SomeZodObject\n stake?: SomeZodObject\n claim?: SomeZodObject\n swap?: SomeZodObject\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,gBAAN,cAA4B,MAAM;AAAC;AACnC,IAAM,aAAN,cAAyB,MAAM;AAAC;;;ACDvC,mBAAwD;AAEjD,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;;;ACHnC,IAAAA,gBAA2B;AAC3B,iBAAkB;AAClB,4BAAqC;AAAA,IAIrC,4CAAqB,YAAC;AAIf,IAAM,KAAK;AAAA,EAChB,SAAS,MACP,aAAE,OAAO,EAAE,UAAU,CAAC,KAAK,QAAQ;AACjC,QAAI;AACF,iBAAO,0BAAW,GAAG;AAAA,IACvB,SAAS,GAAP;AACA,UAAI,SAAS;AAAA,QACX,MAAM,aAAE,aAAa;AAAA,QACrB,SAAS;AAAA,MACX,CAAC;AACD,aAAO,aAAE;AAAA,IACX;AAAA,EACF,CAAC;AACL;;;AClBO,IAAK,QAAL,kBAAKC,WAAL;AACL,EAAAA,OAAA,SAAM;AACN,EAAAA,OAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;","names":["import_utils","Chain"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MintPaused,
|
|
3
|
+
NotFoundError,
|
|
4
|
+
zx
|
|
5
|
+
} from "./chunk-CS4FH2KK.mjs";
|
|
6
|
+
|
|
7
|
+
// src/encode.ts
|
|
8
|
+
import { formatBytes32String, parseBytes32String } from "ethers/lib/utils";
|
|
9
|
+
var encodeBytes32String = formatBytes32String;
|
|
10
|
+
var decodeBytes32String = parseBytes32String;
|
|
11
|
+
|
|
12
|
+
// src/types.ts
|
|
13
|
+
var Chain = /* @__PURE__ */ ((Chain2) => {
|
|
14
|
+
Chain2["eth"] = "eth";
|
|
15
|
+
Chain2["gor"] = "gor";
|
|
16
|
+
return Chain2;
|
|
17
|
+
})(Chain || {});
|
|
18
|
+
export {
|
|
19
|
+
Chain,
|
|
20
|
+
MintPaused,
|
|
21
|
+
NotFoundError,
|
|
22
|
+
decodeBytes32String,
|
|
23
|
+
encodeBytes32String,
|
|
24
|
+
zx
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/encode.ts","../src/types.ts"],"sourcesContent":["import { formatBytes32String, parseBytes32String } from \"ethers/lib/utils\"\n\nexport const encodeBytes32String = formatBytes32String\nexport const decodeBytes32String = parseBytes32String\n","import { SomeZodObject } from \"zod\"\nimport { PresetAllowEntry } from \"zodiac-roles-sdk\"\n\nexport type Action = \"deposit\" | \"borrow\" | \"stake\" | \"claim\" | \"swap\"\n\nexport enum Chain {\n eth = \"eth\",\n gor = \"gor\",\n}\n\ninterface DepositOptions {\n /** The deposit target, an AMM pool, specific money market identified by either name or address */\n targets: any[]\n\n /** A list of tokens that can be deposited, identified by symbol or address. If not set all tokens of the pool are allowed. */\n tokens?: any[]\n}\n\ninterface BorrowOptions {\n /** The tokens that can be borrowed */\n tokens: any[]\n}\n\ninterface StakeOptions {\n targets: any[]\n}\n\ninterface ClaimOptions {}\n\ntype SwapOptions =\n | {\n /** List of tokens that can be sold, identified by symbol or address. */\n sell: any[]\n /** List of tokens that can be bought, identified by symbol or address. */\n buy: any[]\n /** List of pools that can be used, identified by name or address. If not set it will generate permissions for all pools containing any pair of the sell and buy tokens. */\n pools?: any[]\n }\n | {\n /** List of tokens that can be sold, identified by symbol or address. If not set all tokens in the listed pools can be sold. */\n sell?: any[]\n /** List of tokens that can be bought, identified by symbol or address. If not set all tokens in the listed pools can be bought. */\n buy?: any[]\n /** List of pools that can be used, identified by name or address. */\n pools: any[]\n }\n\n// These types define the common interface for actions across all protocols\nexport type ProtocolActions = {\n deposit?: (options: DepositOptions) => PresetAllowEntry[]\n\n borrow?: (options: BorrowOptions) => PresetAllowEntry[]\n\n stake?: (options: StakeOptions) => PresetAllowEntry[]\n\n // TODO do we wanna keep this as a standard action\n claim?: (options: ClaimOptions) => PresetAllowEntry[]\n\n swap?: (options: SwapOptions) => PresetAllowEntry[]\n}\n\n// For registering protocols in the REST API we need zod schemas for the specific parameters of each action\nexport type ProtocolSchemas = {\n deposit?: SomeZodObject\n borrow?: SomeZodObject\n stake?: SomeZodObject\n claim?: SomeZodObject\n swap?: SomeZodObject\n}\n"],"mappings":";;;;;;;AAAA,SAAS,qBAAqB,0BAA0B;AAEjD,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;;;ACE5B,IAAK,QAAL,kBAAKA,WAAL;AACL,EAAAA,OAAA,SAAM;AACN,EAAAA,OAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;","names":["Chain"]}
|