@pufferfinance/puffer-sdk 1.20.2 → 1.21.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/contracts/abis/mainnet/GuardianModule.cjs +2 -0
- package/dist/contracts/abis/mainnet/GuardianModule.cjs.map +1 -0
- package/dist/contracts/abis/mainnet/GuardianModule.d.ts +301 -0
- package/dist/contracts/abis/mainnet/GuardianModule.js +205 -0
- package/dist/contracts/abis/mainnet/GuardianModule.js.map +1 -0
- package/dist/contracts/addresses.cjs +1 -1
- package/dist/contracts/addresses.cjs.map +1 -1
- package/dist/contracts/addresses.d.ts +3 -0
- package/dist/contracts/addresses.js +6 -4
- package/dist/contracts/addresses.js.map +1 -1
- package/dist/contracts/handlers/guardian-module-handler.cjs +2 -0
- package/dist/contracts/handlers/guardian-module-handler.cjs.map +1 -0
- package/dist/contracts/handlers/guardian-module-handler.d.ts +14945 -0
- package/dist/contracts/handlers/guardian-module-handler.js +146 -0
- package/dist/contracts/handlers/guardian-module-handler.js.map +1 -0
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var s = (r, t, e) => t in r ? i(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var n = (r, t, e) => s(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { V as d } from "../../constants-LC89CXNv.js";
|
|
5
|
+
import { CONTRACT_ADDRESSES as u } from "../addresses.js";
|
|
6
|
+
import { GuardianModule as o } from "../abis/mainnet/GuardianModule.js";
|
|
7
|
+
import { g as c } from "../../getContract-Ck2VtUkY.js";
|
|
8
|
+
class G {
|
|
9
|
+
/**
|
|
10
|
+
* Create the handler for the `PufLocker` contract exposing methods to
|
|
11
|
+
* interact with the contract.
|
|
12
|
+
*
|
|
13
|
+
* @param chain Chain to use for the client.
|
|
14
|
+
* @param walletClient The wallet client to use for wallet
|
|
15
|
+
* interactions.
|
|
16
|
+
* @param publicClient The public client to use for public
|
|
17
|
+
* interactions.
|
|
18
|
+
*/
|
|
19
|
+
constructor(t, e, a) {
|
|
20
|
+
n(this, "viemChain");
|
|
21
|
+
this.chain = t, this.walletClient = e, this.publicClient = a, this.viemChain = d[t];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the contract. This is a method because the typings are complex
|
|
25
|
+
* and lost when trying to make it a member.
|
|
26
|
+
*
|
|
27
|
+
* @returns The viem contract.
|
|
28
|
+
*/
|
|
29
|
+
getContract() {
|
|
30
|
+
const t = u[this.chain].GuardianModule, e = o, a = { public: this.publicClient, wallet: this.walletClient };
|
|
31
|
+
return c({ address: t, abi: e, client: a });
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get the ejection threshold.
|
|
35
|
+
*
|
|
36
|
+
* @returns The ejection threshold.
|
|
37
|
+
*/
|
|
38
|
+
getEjectionThreshold() {
|
|
39
|
+
return this.getContract().read.getEjectionThreshold();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the guardians.
|
|
43
|
+
*
|
|
44
|
+
* @returns The guardians.
|
|
45
|
+
*/
|
|
46
|
+
getGuardians() {
|
|
47
|
+
return this.getContract().read.getGuardians();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get the enclave address for a guardian.
|
|
51
|
+
*
|
|
52
|
+
* @param guardian The guardian address.
|
|
53
|
+
* @returns The enclave address.
|
|
54
|
+
*/
|
|
55
|
+
getGuardiansEnclaveAddress(t) {
|
|
56
|
+
return this.getContract().read.getGuardiansEnclaveAddress([t]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get the enclave addresses for all guardians.
|
|
60
|
+
*
|
|
61
|
+
* @returns The enclave addresses.
|
|
62
|
+
*/
|
|
63
|
+
getGuardiansEnclaveAddresses() {
|
|
64
|
+
return this.getContract().read.getGuardiansEnclaveAddresses();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the enclave pubkeys for all guardians.
|
|
68
|
+
*
|
|
69
|
+
* @returns The enclave pubkeys.
|
|
70
|
+
*/
|
|
71
|
+
getGuardiansEnclavePubkeys() {
|
|
72
|
+
return this.getContract().read.getGuardiansEnclavePubkeys();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validate the enclave signatures for a signed message.
|
|
76
|
+
*
|
|
77
|
+
* @param enclaveSignatures The enclave signatures.
|
|
78
|
+
* @param signedMessageHash The signed message hash.
|
|
79
|
+
* @returns The validation result.
|
|
80
|
+
*/
|
|
81
|
+
validateGuardiansEnclaveSignatures(t, e) {
|
|
82
|
+
return this.getContract().read.validateGuardiansEnclaveSignatures([
|
|
83
|
+
t,
|
|
84
|
+
e
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get the mrenclave.
|
|
89
|
+
*
|
|
90
|
+
* @returns The mrenclave.
|
|
91
|
+
*/
|
|
92
|
+
getMrenclave() {
|
|
93
|
+
return this.getContract().read.getMrenclave();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the mrsigner.
|
|
97
|
+
*
|
|
98
|
+
* @returns The mrsigner.
|
|
99
|
+
*/
|
|
100
|
+
getMrsigner() {
|
|
101
|
+
return this.getContract().read.getMrsigner();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get the threshold.
|
|
105
|
+
*
|
|
106
|
+
* @returns The threshold.
|
|
107
|
+
*/
|
|
108
|
+
getThreshold() {
|
|
109
|
+
return this.getContract().read.getThreshold();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check if the guardian module is consuming scheduled operations.
|
|
113
|
+
*
|
|
114
|
+
* @returns True if the guardian module is consuming scheduled operations,
|
|
115
|
+
* false otherwise.
|
|
116
|
+
*/
|
|
117
|
+
isConsumingScheduledOp() {
|
|
118
|
+
return this.getContract().read.isConsumingScheduledOp();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Check if an account is a guardian.
|
|
122
|
+
*
|
|
123
|
+
* @param account The account address.
|
|
124
|
+
* @returns True if the account is a guardian, false otherwise.
|
|
125
|
+
*/
|
|
126
|
+
isGuardian(t) {
|
|
127
|
+
return this.getContract().read.isGuardian([t]);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Remove a guardian.
|
|
131
|
+
*
|
|
132
|
+
* @param guardian The guardian address.
|
|
133
|
+
* @param account The account address to make the transaction with.
|
|
134
|
+
* @returns The transaction receipt.
|
|
135
|
+
*/
|
|
136
|
+
removeGuardian(t, e) {
|
|
137
|
+
return this.getContract().write.removeGuardian([t], {
|
|
138
|
+
account: e,
|
|
139
|
+
chain: this.viemChain
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
G as GuardianModuleHandler
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=guardian-module-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardian-module-handler.js","sources":["../../../lib/contracts/handlers/guardian-module-handler.ts"],"sourcesContent":["import {\n Address,\n getContract,\n GetContractReturnType,\n Hash,\n PublicClient,\n Chain as ViemChain,\n WalletClient,\n} from 'viem';\nimport { Chain, VIEM_CHAINS } from '../../chains/constants';\nimport { CONTRACT_ADDRESSES } from '../addresses';\nimport { GuardianModule } from '../abis/mainnet/GuardianModule';\n\n/**\n * Handler for the `GuardianModule` contract exposing methods to\n * interact with the contract.\n */\nexport class GuardianModuleHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `PufLocker` contract exposing methods to\n * interact with the contract.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = CONTRACT_ADDRESSES[this.chain].GuardianModule as Address;\n const abi = GuardianModule;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the ejection threshold.\n *\n * @returns The ejection threshold.\n */\n public getEjectionThreshold() {\n return this.getContract().read.getEjectionThreshold();\n }\n\n /**\n * Get the guardians.\n *\n * @returns The guardians.\n */\n public getGuardians() {\n return this.getContract().read.getGuardians();\n }\n\n /**\n * Get the enclave address for a guardian.\n *\n * @param guardian The guardian address.\n * @returns The enclave address.\n */\n public getGuardiansEnclaveAddress(guardian: Address) {\n return this.getContract().read.getGuardiansEnclaveAddress([guardian]);\n }\n\n /**\n * Get the enclave addresses for all guardians.\n *\n * @returns The enclave addresses.\n */\n public getGuardiansEnclaveAddresses() {\n return this.getContract().read.getGuardiansEnclaveAddresses();\n }\n\n /**\n * Get the enclave pubkeys for all guardians.\n *\n * @returns The enclave pubkeys.\n */\n public getGuardiansEnclavePubkeys() {\n return this.getContract().read.getGuardiansEnclavePubkeys();\n }\n\n /**\n * Validate the enclave signatures for a signed message.\n *\n * @param enclaveSignatures The enclave signatures.\n * @param signedMessageHash The signed message hash.\n * @returns The validation result.\n */\n public validateGuardiansEnclaveSignatures(\n enclaveSignatures: Address[],\n signedMessageHash: Hash,\n ) {\n return this.getContract().read.validateGuardiansEnclaveSignatures([\n enclaveSignatures,\n signedMessageHash,\n ]);\n }\n\n /**\n * Get the mrenclave.\n *\n * @returns The mrenclave.\n */\n public getMrenclave() {\n return this.getContract().read.getMrenclave();\n }\n\n /**\n * Get the mrsigner.\n *\n * @returns The mrsigner.\n */\n public getMrsigner() {\n return this.getContract().read.getMrsigner();\n }\n\n /**\n * Get the threshold.\n *\n * @returns The threshold.\n */\n public getThreshold() {\n return this.getContract().read.getThreshold();\n }\n\n /**\n * Check if the guardian module is consuming scheduled operations.\n *\n * @returns True if the guardian module is consuming scheduled operations,\n * false otherwise.\n */\n public isConsumingScheduledOp() {\n return this.getContract().read.isConsumingScheduledOp();\n }\n\n /**\n * Check if an account is a guardian.\n *\n * @param account The account address.\n * @returns True if the account is a guardian, false otherwise.\n */\n public isGuardian(account: Address) {\n return this.getContract().read.isGuardian([account]);\n }\n\n /**\n * Remove a guardian.\n *\n * @param guardian The guardian address.\n * @param account The account address to make the transaction with.\n * @returns The transaction receipt.\n */\n public removeGuardian(guardian: Address, account: Address) {\n return this.getContract().write.removeGuardian([guardian], {\n account,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["GuardianModuleHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","CONTRACT_ADDRESSES","abi","GuardianModule","client","getContract","guardian","enclaveSignatures","signedMessageHash","account"],"mappings":";;;;;;;AAiBO,MAAMA,EAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAajC,YACUC,GACAC,GACAC,GACR;AAhBM,IAAAC,EAAA;AAaE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,cAAc;AACnB,UAAMK,IAAUC,EAAmB,KAAK,KAAK,EAAE,gBACzCC,IAAMC,GACNC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYtC,uBAAuB;AAC5B,WAAO,KAAK,cAAc,KAAK,qBAAqB;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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,CAAQ,GAAG;AAAA,MACzD,SAAAG;AAAA,MACA,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAEL;"}
|
package/dist/utils/version.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.20.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.20.2",o=e;exports.version=o;
|
|
2
2
|
//# sourceMappingURL=version.cjs.map
|
package/dist/utils/version.js
CHANGED
package/package.json
CHANGED