@sage-protocol/sdk 0.2.5 → 0.2.8
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/README.md +2 -0
- package/dist/browser/index.mjs +22 -8
- package/dist/index.cjs +143 -62
- package/dist/index.mjs +143 -62
- package/dist/node/index.cjs +143 -62
- package/dist/node/index.mjs +143 -62
- package/package.json +1 -1
- package/types/index.d.ts +158 -19
package/README.md
CHANGED
|
@@ -126,6 +126,8 @@ const res = await sdk.subdao.createOperatorSubDAO({
|
|
|
126
126
|
});
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
Note: if you call the factory's operator-creation functions directly (e.g., `createSubDAOOperator*`), you must pass a non-zero `operatorAdmin` (it may be the same as `operatorExecutor`).
|
|
130
|
+
|
|
129
131
|
### Library Fork Fees
|
|
130
132
|
|
|
131
133
|
```js
|
package/dist/browser/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ var require_package = __commonJS({
|
|
|
14
14
|
"package.json"(exports, module) {
|
|
15
15
|
module.exports = {
|
|
16
16
|
name: "@sage-protocol/sdk",
|
|
17
|
-
version: "0.2.
|
|
17
|
+
version: "0.2.8",
|
|
18
18
|
description: "Backend-agnostic SDK for interacting with the Sage Protocol (governance, SubDAOs, tokens).",
|
|
19
19
|
main: "dist/index.cjs",
|
|
20
20
|
module: "dist/index.mjs",
|
|
@@ -140,7 +140,6 @@ var require_abi = __commonJS({
|
|
|
140
140
|
// Core factory reads
|
|
141
141
|
"function timelockMinDelay() view returns (uint256)",
|
|
142
142
|
"function premiumPromptsAddress() view returns (address)",
|
|
143
|
-
"function simpleKeyStoreAddress() view returns (address)",
|
|
144
143
|
"function governanceConfigAddress() view returns (address)",
|
|
145
144
|
"function libraryRegistryAddress() view returns (address)",
|
|
146
145
|
// Canonical per‑SubDAO mapping
|
|
@@ -327,14 +326,28 @@ var require_abi = __commonJS({
|
|
|
327
326
|
"event TokensSwept(address indexed token, address indexed to, uint256 amount)"
|
|
328
327
|
];
|
|
329
328
|
var GovernanceBoostMerkle = [
|
|
330
|
-
"function
|
|
331
|
-
"function
|
|
332
|
-
"function
|
|
329
|
+
"function createBoost(uint256 proposalId, uint256 totalPool)",
|
|
330
|
+
"function setMerkleRoot(uint256 proposalId, bytes32 root)",
|
|
331
|
+
"function finalize(uint256 proposalId)",
|
|
332
|
+
"function claim(uint256 proposalId, address account, uint256 amount, bytes32[] proof)",
|
|
333
|
+
"function getBoost(uint256 proposalId) view returns (uint256 totalPool, uint256 totalClaimed, bytes32 merkleRoot, bool active, bool finalized, address creator)",
|
|
334
|
+
"function claimed(uint256 proposalId, address account) view returns (bool)",
|
|
335
|
+
"event BoostCreated(uint256 indexed proposalId, address indexed creator, uint256 totalPool)",
|
|
336
|
+
"event MerkleRootSet(uint256 indexed proposalId, bytes32 merkleRoot)",
|
|
337
|
+
"event RewardClaimed(uint256 indexed proposalId, address indexed voter, uint256 amount)",
|
|
338
|
+
"event BoostFinalized(uint256 indexed proposalId, uint256 totalClaimed, uint256 refunded)"
|
|
333
339
|
];
|
|
334
340
|
var GovernanceBoostDirect = [
|
|
335
|
-
"function
|
|
336
|
-
"function
|
|
337
|
-
"function
|
|
341
|
+
"function createBoost((address governor,uint256 proposalId,uint256 perVoter,uint256 maxVoters,uint8 kind,address policy,uint96 minVotes,uint8 payoutMode,uint8 support,uint256 startAt,uint256 expiresAt) params)",
|
|
342
|
+
"function claim(uint256 proposalId, bytes data)",
|
|
343
|
+
"function finalize(uint256 proposalId)",
|
|
344
|
+
"function pause(uint256 proposalId, bool paused)",
|
|
345
|
+
"function setProtocolRake(uint96 rakeBps, address protocolTreasury)",
|
|
346
|
+
"function getBoost(uint256 proposalId) view returns (tuple(address creator, address governor, uint256 proposalId, uint256 snapshot, uint256 perVoter, uint256 maxVoters, uint256 votersPaid, uint96 minVotes, uint8 payoutMode, uint8 support, uint256 startAt, uint256 expiresAt, uint256 totalPool, uint256 totalPaid, uint8 kind, address policy, bool active, bool paused) boost)",
|
|
347
|
+
"function claimed(uint256 proposalId, address account) view returns (bool)",
|
|
348
|
+
"event BoostCreated(uint256 indexed proposalId, address indexed governor, uint256 perVoter, uint256 maxVoters, uint256 snapshot, uint8 kind, address policy, uint96 minVotes)",
|
|
349
|
+
"event BoostClaimed(uint256 indexed proposalId, address indexed claimer, uint256 amount, uint256 rake)",
|
|
350
|
+
"event BoostFinalized(uint256 indexed proposalId, uint256 paidCount, uint256 refund)"
|
|
338
351
|
];
|
|
339
352
|
var VotingMultiplierNFT = [
|
|
340
353
|
// Constants
|
|
@@ -342,6 +355,7 @@ var require_abi = __commonJS({
|
|
|
342
355
|
"function MAX_NFTS_PER_ACCOUNT() view returns (uint256)",
|
|
343
356
|
// Tier Management
|
|
344
357
|
"function createTier(address dao, string name, uint256 multiplier, uint256 maxSupply, uint256 price) returns (uint256 tierId)",
|
|
358
|
+
"function createTierViaGovernance(address subdao, string name, uint256 multiplier, uint256 maxSupply, uint256 price) returns (uint256 tierId)",
|
|
345
359
|
"function getTier(uint256 tierId) view returns (tuple(string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao))",
|
|
346
360
|
"function tierCount() view returns (uint256)",
|
|
347
361
|
"function tiers(uint256) view returns (string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao)",
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ var require_package = __commonJS({
|
|
|
14
14
|
"package.json"(exports2, module2) {
|
|
15
15
|
module2.exports = {
|
|
16
16
|
name: "@sage-protocol/sdk",
|
|
17
|
-
version: "0.2.
|
|
17
|
+
version: "0.2.8",
|
|
18
18
|
description: "Backend-agnostic SDK for interacting with the Sage Protocol (governance, SubDAOs, tokens).",
|
|
19
19
|
main: "dist/index.cjs",
|
|
20
20
|
module: "dist/index.mjs",
|
|
@@ -140,7 +140,6 @@ var require_abi = __commonJS({
|
|
|
140
140
|
// Core factory reads
|
|
141
141
|
"function timelockMinDelay() view returns (uint256)",
|
|
142
142
|
"function premiumPromptsAddress() view returns (address)",
|
|
143
|
-
"function simpleKeyStoreAddress() view returns (address)",
|
|
144
143
|
"function governanceConfigAddress() view returns (address)",
|
|
145
144
|
"function libraryRegistryAddress() view returns (address)",
|
|
146
145
|
// Canonical per‑SubDAO mapping
|
|
@@ -327,14 +326,28 @@ var require_abi = __commonJS({
|
|
|
327
326
|
"event TokensSwept(address indexed token, address indexed to, uint256 amount)"
|
|
328
327
|
];
|
|
329
328
|
var GovernanceBoostMerkle = [
|
|
330
|
-
"function
|
|
331
|
-
"function
|
|
332
|
-
"function
|
|
329
|
+
"function createBoost(uint256 proposalId, uint256 totalPool)",
|
|
330
|
+
"function setMerkleRoot(uint256 proposalId, bytes32 root)",
|
|
331
|
+
"function finalize(uint256 proposalId)",
|
|
332
|
+
"function claim(uint256 proposalId, address account, uint256 amount, bytes32[] proof)",
|
|
333
|
+
"function getBoost(uint256 proposalId) view returns (uint256 totalPool, uint256 totalClaimed, bytes32 merkleRoot, bool active, bool finalized, address creator)",
|
|
334
|
+
"function claimed(uint256 proposalId, address account) view returns (bool)",
|
|
335
|
+
"event BoostCreated(uint256 indexed proposalId, address indexed creator, uint256 totalPool)",
|
|
336
|
+
"event MerkleRootSet(uint256 indexed proposalId, bytes32 merkleRoot)",
|
|
337
|
+
"event RewardClaimed(uint256 indexed proposalId, address indexed voter, uint256 amount)",
|
|
338
|
+
"event BoostFinalized(uint256 indexed proposalId, uint256 totalClaimed, uint256 refunded)"
|
|
333
339
|
];
|
|
334
340
|
var GovernanceBoostDirect = [
|
|
335
|
-
"function
|
|
336
|
-
"function
|
|
337
|
-
"function
|
|
341
|
+
"function createBoost((address governor,uint256 proposalId,uint256 perVoter,uint256 maxVoters,uint8 kind,address policy,uint96 minVotes,uint8 payoutMode,uint8 support,uint256 startAt,uint256 expiresAt) params)",
|
|
342
|
+
"function claim(uint256 proposalId, bytes data)",
|
|
343
|
+
"function finalize(uint256 proposalId)",
|
|
344
|
+
"function pause(uint256 proposalId, bool paused)",
|
|
345
|
+
"function setProtocolRake(uint96 rakeBps, address protocolTreasury)",
|
|
346
|
+
"function getBoost(uint256 proposalId) view returns (tuple(address creator, address governor, uint256 proposalId, uint256 snapshot, uint256 perVoter, uint256 maxVoters, uint256 votersPaid, uint96 minVotes, uint8 payoutMode, uint8 support, uint256 startAt, uint256 expiresAt, uint256 totalPool, uint256 totalPaid, uint8 kind, address policy, bool active, bool paused) boost)",
|
|
347
|
+
"function claimed(uint256 proposalId, address account) view returns (bool)",
|
|
348
|
+
"event BoostCreated(uint256 indexed proposalId, address indexed governor, uint256 perVoter, uint256 maxVoters, uint256 snapshot, uint8 kind, address policy, uint96 minVotes)",
|
|
349
|
+
"event BoostClaimed(uint256 indexed proposalId, address indexed claimer, uint256 amount, uint256 rake)",
|
|
350
|
+
"event BoostFinalized(uint256 indexed proposalId, uint256 paidCount, uint256 refund)"
|
|
338
351
|
];
|
|
339
352
|
var VotingMultiplierNFT = [
|
|
340
353
|
// Constants
|
|
@@ -342,6 +355,7 @@ var require_abi = __commonJS({
|
|
|
342
355
|
"function MAX_NFTS_PER_ACCOUNT() view returns (uint256)",
|
|
343
356
|
// Tier Management
|
|
344
357
|
"function createTier(address dao, string name, uint256 multiplier, uint256 maxSupply, uint256 price) returns (uint256 tierId)",
|
|
358
|
+
"function createTierViaGovernance(address subdao, string name, uint256 multiplier, uint256 maxSupply, uint256 price) returns (uint256 tierId)",
|
|
345
359
|
"function getTier(uint256 tierId) view returns (tuple(string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao))",
|
|
346
360
|
"function tierCount() view returns (uint256)",
|
|
347
361
|
"function tiers(uint256) view returns (string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao)",
|
|
@@ -6925,6 +6939,7 @@ var require_factory = __commonJS({
|
|
|
6925
6939
|
var { Contract, Interface, getAddress } = require("ethers");
|
|
6926
6940
|
var ABI = require_abi();
|
|
6927
6941
|
var { SageSDKError, CODES } = require_errors();
|
|
6942
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
6928
6943
|
function normalise(address, label) {
|
|
6929
6944
|
if (!address) throw new SageSDKError(CODES.INVALID_ARGS, `${label} required`);
|
|
6930
6945
|
try {
|
|
@@ -6933,6 +6948,14 @@ var require_factory = __commonJS({
|
|
|
6933
6948
|
throw new SageSDKError(CODES.INVALID_ARGS, `invalid ${label}`, { cause: err });
|
|
6934
6949
|
}
|
|
6935
6950
|
}
|
|
6951
|
+
function normaliseNonZero(address, label) {
|
|
6952
|
+
const addr = normalise(address, label);
|
|
6953
|
+
if (addr === ZERO_ADDRESS) {
|
|
6954
|
+
const hint = label === "operatorAdmin" ? " (set it explicitly; it may be the same as operatorExecutor)" : "";
|
|
6955
|
+
throw new SageSDKError(CODES.INVALID_ARGS, `${label} cannot be zero address${hint}`);
|
|
6956
|
+
}
|
|
6957
|
+
return addr;
|
|
6958
|
+
}
|
|
6936
6959
|
async function getFactoryConfig({ provider, factory: factory2 }) {
|
|
6937
6960
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
6938
6961
|
const addr = normalise(factory2, "factory");
|
|
@@ -6946,7 +6969,6 @@ var require_factory = __commonJS({
|
|
|
6946
6969
|
allowStableForkFee,
|
|
6947
6970
|
timelockMinDelay,
|
|
6948
6971
|
premiumPromptsAddress,
|
|
6949
|
-
simpleKeyStoreAddress,
|
|
6950
6972
|
governanceConfigAddress,
|
|
6951
6973
|
libraryRegistryAddress,
|
|
6952
6974
|
templateModule
|
|
@@ -6969,7 +6991,6 @@ var require_factory = __commonJS({
|
|
|
6969
6991
|
contract.allowStableForkFee().catch(() => null),
|
|
6970
6992
|
contract.timelockMinDelay().catch(() => null),
|
|
6971
6993
|
contract.premiumPromptsAddress().catch(() => null),
|
|
6972
|
-
contract.simpleKeyStoreAddress().catch(() => null),
|
|
6973
6994
|
contract.governanceConfigAddress().catch(() => null),
|
|
6974
6995
|
contract.libraryRegistryAddress().catch(() => null),
|
|
6975
6996
|
contract.templateModule().catch(() => null)
|
|
@@ -6984,7 +7005,6 @@ var require_factory = __commonJS({
|
|
|
6984
7005
|
allowStableForkFee,
|
|
6985
7006
|
timelockMinDelay,
|
|
6986
7007
|
premiumPromptsAddress: premiumPromptsAddress && premiumPromptsAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(premiumPromptsAddress) : null,
|
|
6987
|
-
simpleKeyStoreAddress: simpleKeyStoreAddress && simpleKeyStoreAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(simpleKeyStoreAddress) : null,
|
|
6988
7008
|
governanceConfigAddress: governanceConfigAddress && governanceConfigAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(governanceConfigAddress) : null,
|
|
6989
7009
|
libraryRegistryAddress: libraryRegistryAddress && libraryRegistryAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(libraryRegistryAddress) : null,
|
|
6990
7010
|
templateModule: templateModule ? getAddress(templateModule) : null
|
|
@@ -7198,7 +7218,7 @@ var require_factory = __commonJS({
|
|
|
7198
7218
|
0n,
|
|
7199
7219
|
// minStakeAmount deprecated
|
|
7200
7220
|
normalise(operatorExecutor, "operatorExecutor"),
|
|
7201
|
-
|
|
7221
|
+
normaliseNonZero(operatorAdmin, "operatorAdmin"),
|
|
7202
7222
|
tuple
|
|
7203
7223
|
]);
|
|
7204
7224
|
return { to: addr, data: payload, value: 0n };
|
|
@@ -7230,7 +7250,7 @@ var require_factory = __commonJS({
|
|
|
7230
7250
|
0n,
|
|
7231
7251
|
// minStakeAmount deprecated
|
|
7232
7252
|
normalise(operatorExecutor, "operatorExecutor"),
|
|
7233
|
-
|
|
7253
|
+
normaliseNonZero(operatorAdmin, "operatorAdmin"),
|
|
7234
7254
|
Boolean(anyoneExec),
|
|
7235
7255
|
Boolean(governorProposer),
|
|
7236
7256
|
tuple
|
|
@@ -9451,70 +9471,145 @@ var require_boost = __commonJS({
|
|
|
9451
9471
|
throw new SageSDKError(CODES.RPC_ERROR, "failed to normalise bigint", { cause: err });
|
|
9452
9472
|
}
|
|
9453
9473
|
}
|
|
9454
|
-
|
|
9474
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
9475
|
+
async function getMerkleBoost({ provider, manager, proposalId }) {
|
|
9455
9476
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
9456
9477
|
const addr = normalise(manager, "manager");
|
|
9457
9478
|
const contract = new Contract(addr, ABI.GovernanceBoostMerkle, provider);
|
|
9458
|
-
const
|
|
9459
|
-
if (!
|
|
9479
|
+
const result = await contract.getBoost(proposalId).catch(() => null);
|
|
9480
|
+
if (!result) return null;
|
|
9481
|
+
const [totalPool, totalClaimed, merkleRoot, active, finalized, creator] = result;
|
|
9482
|
+
const creatorAddr = creator ? getAddress(creator) : ZERO_ADDRESS;
|
|
9483
|
+
const pool = toBigInt(totalPool);
|
|
9484
|
+
if (!active && !finalized && pool === 0n && creatorAddr === ZERO_ADDRESS) return null;
|
|
9460
9485
|
return {
|
|
9461
9486
|
manager: addr,
|
|
9462
|
-
proposalId: Number(
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9487
|
+
proposalId: Number(proposalId),
|
|
9488
|
+
totalPool: pool,
|
|
9489
|
+
totalClaimed: toBigInt(totalClaimed),
|
|
9490
|
+
merkleRoot,
|
|
9491
|
+
active: Boolean(active),
|
|
9492
|
+
finalized: Boolean(finalized),
|
|
9493
|
+
creator: creatorAddr
|
|
9468
9494
|
};
|
|
9469
9495
|
}
|
|
9470
|
-
function
|
|
9496
|
+
function buildMerkleCreateTx({ manager, proposalId, totalPool, amount }) {
|
|
9497
|
+
const addr = normalise(manager, "manager");
|
|
9498
|
+
const pool = totalPool ?? amount;
|
|
9499
|
+
const data = MerkleInterface.encodeFunctionData("createBoost", [Number(proposalId), BigInt(pool ?? 0n)]);
|
|
9500
|
+
return { to: addr, data, value: 0n };
|
|
9501
|
+
}
|
|
9502
|
+
function buildMerkleSetMerkleRootTx({ manager, proposalId, root, merkleRoot }) {
|
|
9503
|
+
const addr = normalise(manager, "manager");
|
|
9504
|
+
const nextRoot = root ?? merkleRoot;
|
|
9505
|
+
const data = MerkleInterface.encodeFunctionData("setMerkleRoot", [Number(proposalId), nextRoot]);
|
|
9506
|
+
return { to: addr, data, value: 0n };
|
|
9507
|
+
}
|
|
9508
|
+
function buildMerkleFinalizeTx({ manager, proposalId }) {
|
|
9471
9509
|
const addr = normalise(manager, "manager");
|
|
9472
|
-
const data = MerkleInterface.encodeFunctionData("
|
|
9510
|
+
const data = MerkleInterface.encodeFunctionData("finalize", [Number(proposalId)]);
|
|
9473
9511
|
return { to: addr, data, value: 0n };
|
|
9474
9512
|
}
|
|
9475
|
-
function
|
|
9513
|
+
function buildMerkleClaimTx({ manager, proposalId, account, amount, proof }) {
|
|
9476
9514
|
const addr = normalise(manager, "manager");
|
|
9477
|
-
const data = MerkleInterface.encodeFunctionData("
|
|
9515
|
+
const data = MerkleInterface.encodeFunctionData("claim", [
|
|
9516
|
+
Number(proposalId),
|
|
9517
|
+
normalise(account, "account"),
|
|
9518
|
+
BigInt(amount ?? 0n),
|
|
9519
|
+
proof || []
|
|
9520
|
+
]);
|
|
9478
9521
|
return { to: addr, data, value: 0n };
|
|
9479
9522
|
}
|
|
9480
|
-
async function
|
|
9523
|
+
async function getDirectBoost({ provider, manager, proposalId }) {
|
|
9481
9524
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
9482
9525
|
const addr = normalise(manager, "manager");
|
|
9483
9526
|
const contract = new Contract(addr, ABI.GovernanceBoostDirect, provider);
|
|
9484
|
-
const
|
|
9485
|
-
if (!
|
|
9527
|
+
const boost2 = await contract.getBoost(proposalId).catch(() => null);
|
|
9528
|
+
if (!boost2) return null;
|
|
9529
|
+
const creatorAddr = boost2.creator ? getAddress(boost2.creator) : ZERO_ADDRESS;
|
|
9530
|
+
const pool = toBigInt(boost2.totalPool);
|
|
9531
|
+
if (!boost2.active && pool === 0n && creatorAddr === ZERO_ADDRESS) return null;
|
|
9486
9532
|
return {
|
|
9487
9533
|
manager: addr,
|
|
9488
|
-
proposalId: Number(
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9534
|
+
proposalId: Number(boost2.proposalId ?? proposalId),
|
|
9535
|
+
creator: creatorAddr,
|
|
9536
|
+
governor: boost2.governor ? getAddress(boost2.governor) : null,
|
|
9537
|
+
snapshot: toBigInt(boost2.snapshot),
|
|
9538
|
+
perVoter: toBigInt(boost2.perVoter),
|
|
9539
|
+
maxVoters: toBigInt(boost2.maxVoters),
|
|
9540
|
+
votersPaid: toBigInt(boost2.votersPaid),
|
|
9541
|
+
minVotes: toBigInt(boost2.minVotes),
|
|
9542
|
+
payoutMode: Number(boost2.payoutMode ?? 0),
|
|
9543
|
+
support: Number(boost2.support ?? 0),
|
|
9544
|
+
startAt: Number(boost2.startAt ?? 0),
|
|
9545
|
+
expiresAt: Number(boost2.expiresAt ?? 0),
|
|
9546
|
+
totalPool: pool,
|
|
9547
|
+
totalPaid: toBigInt(boost2.totalPaid),
|
|
9548
|
+
kind: Number(boost2.kind ?? 0),
|
|
9549
|
+
policy: boost2.policy ? getAddress(boost2.policy) : null,
|
|
9550
|
+
active: Boolean(boost2.active),
|
|
9551
|
+
paused: Boolean(boost2.paused)
|
|
9494
9552
|
};
|
|
9495
9553
|
}
|
|
9496
|
-
function buildDirectCreateTx({
|
|
9554
|
+
function buildDirectCreateTx({
|
|
9555
|
+
manager,
|
|
9556
|
+
governor,
|
|
9557
|
+
proposalId,
|
|
9558
|
+
perVoter,
|
|
9559
|
+
maxVoters,
|
|
9560
|
+
kind = 0,
|
|
9561
|
+
policy = ZERO_ADDRESS,
|
|
9562
|
+
minVotes = 0n,
|
|
9563
|
+
payoutMode = 0,
|
|
9564
|
+
support = 0,
|
|
9565
|
+
startAt = 0n,
|
|
9566
|
+
expiresAt = 0n
|
|
9567
|
+
}) {
|
|
9497
9568
|
const addr = normalise(manager, "manager");
|
|
9498
|
-
const
|
|
9499
|
-
|
|
9500
|
-
|
|
9569
|
+
const params = [
|
|
9570
|
+
normalise(governor, "governor"),
|
|
9571
|
+
BigInt(proposalId ?? 0n),
|
|
9501
9572
|
BigInt(perVoter ?? 0n),
|
|
9502
|
-
BigInt(maxVoters ?? 0n)
|
|
9503
|
-
|
|
9573
|
+
BigInt(maxVoters ?? 0n),
|
|
9574
|
+
Number(kind),
|
|
9575
|
+
policy ? normalise(policy, "policy") : ZERO_ADDRESS,
|
|
9576
|
+
BigInt(minVotes ?? 0n),
|
|
9577
|
+
Number(payoutMode),
|
|
9578
|
+
Number(support),
|
|
9579
|
+
BigInt(startAt ?? 0n),
|
|
9580
|
+
BigInt(expiresAt ?? 0n)
|
|
9581
|
+
];
|
|
9582
|
+
const data = DirectInterface.encodeFunctionData("createBoost", [params]);
|
|
9504
9583
|
return { to: addr, data, value: 0n };
|
|
9505
9584
|
}
|
|
9506
|
-
function
|
|
9585
|
+
function buildDirectClaimTx({ manager, proposalId, data = "0x" }) {
|
|
9507
9586
|
const addr = normalise(manager, "manager");
|
|
9508
|
-
const
|
|
9587
|
+
const callData = DirectInterface.encodeFunctionData("claim", [BigInt(proposalId ?? 0n), data]);
|
|
9588
|
+
return { to: addr, data: callData, value: 0n };
|
|
9589
|
+
}
|
|
9590
|
+
function buildDirectFinalizeTx({ manager, proposalId }) {
|
|
9591
|
+
const addr = normalise(manager, "manager");
|
|
9592
|
+
const data = DirectInterface.encodeFunctionData("finalize", [BigInt(proposalId ?? 0n)]);
|
|
9509
9593
|
return { to: addr, data, value: 0n };
|
|
9510
9594
|
}
|
|
9511
9595
|
module2.exports = {
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9596
|
+
// Merkle manager (GovernanceBoostManagerMerkle)
|
|
9597
|
+
getMerkleBoost,
|
|
9598
|
+
buildMerkleCreateTx,
|
|
9599
|
+
buildMerkleSetMerkleRootTx,
|
|
9600
|
+
buildMerkleFinalizeTx,
|
|
9601
|
+
buildMerkleClaimTx,
|
|
9602
|
+
// Legacy names (back-compat)
|
|
9603
|
+
getMerkleConfig: getMerkleBoost,
|
|
9604
|
+
buildMerkleFundTx: buildMerkleCreateTx,
|
|
9605
|
+
buildMerkleSetRootTx: buildMerkleSetMerkleRootTx,
|
|
9606
|
+
// Direct manager (GovernanceBoostManager)
|
|
9607
|
+
getDirectBoost,
|
|
9516
9608
|
buildDirectCreateTx,
|
|
9517
|
-
|
|
9609
|
+
buildDirectClaimTx,
|
|
9610
|
+
buildDirectFinalizeTx,
|
|
9611
|
+
// Legacy name (back-compat)
|
|
9612
|
+
getDirectConfig: getDirectBoost
|
|
9518
9613
|
};
|
|
9519
9614
|
}
|
|
9520
9615
|
});
|
|
@@ -12024,20 +12119,6 @@ ${error}` : ""}`;
|
|
|
12024
12119
|
const price = d[2].toString();
|
|
12025
12120
|
const manifest = d[3];
|
|
12026
12121
|
return { signature: sig, args: [hash, subdao2, price, `"${manifest}"`] };
|
|
12027
|
-
} else if (data.startsWith(require("ethers").id("setWrappedKey(bytes32,bytes,bytes32)").slice(0, 10))) {
|
|
12028
|
-
const { ethers: ethers2 } = require("ethers");
|
|
12029
|
-
const sig = "setWrappedKey(bytes32,bytes,bytes32)";
|
|
12030
|
-
const iface = new ethers2.Interface([`function ${sig}`]);
|
|
12031
|
-
const d = iface.decodeFunctionData("setWrappedKey", data);
|
|
12032
|
-
const cidHash = d[0];
|
|
12033
|
-
const wrapped = d[1];
|
|
12034
|
-
const wrapperId = d[2];
|
|
12035
|
-
return { signature: sig, args: [cidHash, wrapped, wrapperId] };
|
|
12036
|
-
} else if (data.startsWith(require("ethers").id("lockKey(bytes32)").slice(0, 10))) {
|
|
12037
|
-
const { ethers: ethers2 } = require("ethers");
|
|
12038
|
-
const iface = new ethers2.Interface(["function lockKey(bytes32)"]);
|
|
12039
|
-
const d = iface.decodeFunctionData("lockKey", data);
|
|
12040
|
-
return { signature: "lockKey(bytes32)", args: [d[0]] };
|
|
12041
12122
|
} else if (data.startsWith(require("ethers").id("claim(uint256,address,uint256,bytes32[])").slice(0, 10))) {
|
|
12042
12123
|
const { ethers: ethers2 } = require("ethers");
|
|
12043
12124
|
const sig = "claim(uint256,address,uint256,bytes32[])";
|