@sage-protocol/sdk 0.2.6 → 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/dist/node/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ var require_package = __commonJS({
|
|
|
20
20
|
"package.json"(exports2, module2) {
|
|
21
21
|
module2.exports = {
|
|
22
22
|
name: "@sage-protocol/sdk",
|
|
23
|
-
version: "0.2.
|
|
23
|
+
version: "0.2.8",
|
|
24
24
|
description: "Backend-agnostic SDK for interacting with the Sage Protocol (governance, SubDAOs, tokens).",
|
|
25
25
|
main: "dist/index.cjs",
|
|
26
26
|
module: "dist/index.mjs",
|
|
@@ -146,7 +146,6 @@ var require_abi = __commonJS({
|
|
|
146
146
|
// Core factory reads
|
|
147
147
|
"function timelockMinDelay() view returns (uint256)",
|
|
148
148
|
"function premiumPromptsAddress() view returns (address)",
|
|
149
|
-
"function simpleKeyStoreAddress() view returns (address)",
|
|
150
149
|
"function governanceConfigAddress() view returns (address)",
|
|
151
150
|
"function libraryRegistryAddress() view returns (address)",
|
|
152
151
|
// Canonical per‑SubDAO mapping
|
|
@@ -333,14 +332,28 @@ var require_abi = __commonJS({
|
|
|
333
332
|
"event TokensSwept(address indexed token, address indexed to, uint256 amount)"
|
|
334
333
|
];
|
|
335
334
|
var GovernanceBoostMerkle = [
|
|
336
|
-
"function
|
|
337
|
-
"function
|
|
338
|
-
"function
|
|
335
|
+
"function createBoost(uint256 proposalId, uint256 totalPool)",
|
|
336
|
+
"function setMerkleRoot(uint256 proposalId, bytes32 root)",
|
|
337
|
+
"function finalize(uint256 proposalId)",
|
|
338
|
+
"function claim(uint256 proposalId, address account, uint256 amount, bytes32[] proof)",
|
|
339
|
+
"function getBoost(uint256 proposalId) view returns (uint256 totalPool, uint256 totalClaimed, bytes32 merkleRoot, bool active, bool finalized, address creator)",
|
|
340
|
+
"function claimed(uint256 proposalId, address account) view returns (bool)",
|
|
341
|
+
"event BoostCreated(uint256 indexed proposalId, address indexed creator, uint256 totalPool)",
|
|
342
|
+
"event MerkleRootSet(uint256 indexed proposalId, bytes32 merkleRoot)",
|
|
343
|
+
"event RewardClaimed(uint256 indexed proposalId, address indexed voter, uint256 amount)",
|
|
344
|
+
"event BoostFinalized(uint256 indexed proposalId, uint256 totalClaimed, uint256 refunded)"
|
|
339
345
|
];
|
|
340
346
|
var GovernanceBoostDirect = [
|
|
341
|
-
"function
|
|
342
|
-
"function
|
|
343
|
-
"function
|
|
347
|
+
"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)",
|
|
348
|
+
"function claim(uint256 proposalId, bytes data)",
|
|
349
|
+
"function finalize(uint256 proposalId)",
|
|
350
|
+
"function pause(uint256 proposalId, bool paused)",
|
|
351
|
+
"function setProtocolRake(uint96 rakeBps, address protocolTreasury)",
|
|
352
|
+
"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)",
|
|
353
|
+
"function claimed(uint256 proposalId, address account) view returns (bool)",
|
|
354
|
+
"event BoostCreated(uint256 indexed proposalId, address indexed governor, uint256 perVoter, uint256 maxVoters, uint256 snapshot, uint8 kind, address policy, uint96 minVotes)",
|
|
355
|
+
"event BoostClaimed(uint256 indexed proposalId, address indexed claimer, uint256 amount, uint256 rake)",
|
|
356
|
+
"event BoostFinalized(uint256 indexed proposalId, uint256 paidCount, uint256 refund)"
|
|
344
357
|
];
|
|
345
358
|
var VotingMultiplierNFT = [
|
|
346
359
|
// Constants
|
|
@@ -348,6 +361,7 @@ var require_abi = __commonJS({
|
|
|
348
361
|
"function MAX_NFTS_PER_ACCOUNT() view returns (uint256)",
|
|
349
362
|
// Tier Management
|
|
350
363
|
"function createTier(address dao, string name, uint256 multiplier, uint256 maxSupply, uint256 price) returns (uint256 tierId)",
|
|
364
|
+
"function createTierViaGovernance(address subdao, string name, uint256 multiplier, uint256 maxSupply, uint256 price) returns (uint256 tierId)",
|
|
351
365
|
"function getTier(uint256 tierId) view returns (tuple(string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao))",
|
|
352
366
|
"function tierCount() view returns (uint256)",
|
|
353
367
|
"function tiers(uint256) view returns (string name, uint256 multiplier, uint256 maxSupply, uint256 minted, uint256 price, address dao)",
|
|
@@ -6931,6 +6945,7 @@ var require_factory = __commonJS({
|
|
|
6931
6945
|
var { Contract, Interface, getAddress } = __require("ethers");
|
|
6932
6946
|
var ABI = require_abi();
|
|
6933
6947
|
var { SageSDKError, CODES } = require_errors();
|
|
6948
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
6934
6949
|
function normalise(address, label) {
|
|
6935
6950
|
if (!address) throw new SageSDKError(CODES.INVALID_ARGS, `${label} required`);
|
|
6936
6951
|
try {
|
|
@@ -6939,6 +6954,14 @@ var require_factory = __commonJS({
|
|
|
6939
6954
|
throw new SageSDKError(CODES.INVALID_ARGS, `invalid ${label}`, { cause: err });
|
|
6940
6955
|
}
|
|
6941
6956
|
}
|
|
6957
|
+
function normaliseNonZero(address, label) {
|
|
6958
|
+
const addr = normalise(address, label);
|
|
6959
|
+
if (addr === ZERO_ADDRESS) {
|
|
6960
|
+
const hint = label === "operatorAdmin" ? " (set it explicitly; it may be the same as operatorExecutor)" : "";
|
|
6961
|
+
throw new SageSDKError(CODES.INVALID_ARGS, `${label} cannot be zero address${hint}`);
|
|
6962
|
+
}
|
|
6963
|
+
return addr;
|
|
6964
|
+
}
|
|
6942
6965
|
async function getFactoryConfig({ provider, factory }) {
|
|
6943
6966
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
6944
6967
|
const addr = normalise(factory, "factory");
|
|
@@ -6952,7 +6975,6 @@ var require_factory = __commonJS({
|
|
|
6952
6975
|
allowStableForkFee,
|
|
6953
6976
|
timelockMinDelay,
|
|
6954
6977
|
premiumPromptsAddress,
|
|
6955
|
-
simpleKeyStoreAddress,
|
|
6956
6978
|
governanceConfigAddress,
|
|
6957
6979
|
libraryRegistryAddress,
|
|
6958
6980
|
templateModule
|
|
@@ -6975,7 +6997,6 @@ var require_factory = __commonJS({
|
|
|
6975
6997
|
contract.allowStableForkFee().catch(() => null),
|
|
6976
6998
|
contract.timelockMinDelay().catch(() => null),
|
|
6977
6999
|
contract.premiumPromptsAddress().catch(() => null),
|
|
6978
|
-
contract.simpleKeyStoreAddress().catch(() => null),
|
|
6979
7000
|
contract.governanceConfigAddress().catch(() => null),
|
|
6980
7001
|
contract.libraryRegistryAddress().catch(() => null),
|
|
6981
7002
|
contract.templateModule().catch(() => null)
|
|
@@ -6990,7 +7011,6 @@ var require_factory = __commonJS({
|
|
|
6990
7011
|
allowStableForkFee,
|
|
6991
7012
|
timelockMinDelay,
|
|
6992
7013
|
premiumPromptsAddress: premiumPromptsAddress && premiumPromptsAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(premiumPromptsAddress) : null,
|
|
6993
|
-
simpleKeyStoreAddress: simpleKeyStoreAddress && simpleKeyStoreAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(simpleKeyStoreAddress) : null,
|
|
6994
7014
|
governanceConfigAddress: governanceConfigAddress && governanceConfigAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(governanceConfigAddress) : null,
|
|
6995
7015
|
libraryRegistryAddress: libraryRegistryAddress && libraryRegistryAddress !== "0x0000000000000000000000000000000000000000" ? getAddress(libraryRegistryAddress) : null,
|
|
6996
7016
|
templateModule: templateModule ? getAddress(templateModule) : null
|
|
@@ -7204,7 +7224,7 @@ var require_factory = __commonJS({
|
|
|
7204
7224
|
0n,
|
|
7205
7225
|
// minStakeAmount deprecated
|
|
7206
7226
|
normalise(operatorExecutor, "operatorExecutor"),
|
|
7207
|
-
|
|
7227
|
+
normaliseNonZero(operatorAdmin, "operatorAdmin"),
|
|
7208
7228
|
tuple
|
|
7209
7229
|
]);
|
|
7210
7230
|
return { to: addr, data: payload, value: 0n };
|
|
@@ -7236,7 +7256,7 @@ var require_factory = __commonJS({
|
|
|
7236
7256
|
0n,
|
|
7237
7257
|
// minStakeAmount deprecated
|
|
7238
7258
|
normalise(operatorExecutor, "operatorExecutor"),
|
|
7239
|
-
|
|
7259
|
+
normaliseNonZero(operatorAdmin, "operatorAdmin"),
|
|
7240
7260
|
Boolean(anyoneExec),
|
|
7241
7261
|
Boolean(governorProposer),
|
|
7242
7262
|
tuple
|
|
@@ -9457,70 +9477,145 @@ var require_boost = __commonJS({
|
|
|
9457
9477
|
throw new SageSDKError(CODES.RPC_ERROR, "failed to normalise bigint", { cause: err });
|
|
9458
9478
|
}
|
|
9459
9479
|
}
|
|
9460
|
-
|
|
9480
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
9481
|
+
async function getMerkleBoost({ provider, manager, proposalId }) {
|
|
9461
9482
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
9462
9483
|
const addr = normalise(manager, "manager");
|
|
9463
9484
|
const contract = new Contract(addr, ABI.GovernanceBoostMerkle, provider);
|
|
9464
|
-
const
|
|
9465
|
-
if (!
|
|
9485
|
+
const result = await contract.getBoost(proposalId).catch(() => null);
|
|
9486
|
+
if (!result) return null;
|
|
9487
|
+
const [totalPool, totalClaimed, merkleRoot, active, finalized, creator] = result;
|
|
9488
|
+
const creatorAddr = creator ? getAddress(creator) : ZERO_ADDRESS;
|
|
9489
|
+
const pool = toBigInt(totalPool);
|
|
9490
|
+
if (!active && !finalized && pool === 0n && creatorAddr === ZERO_ADDRESS) return null;
|
|
9466
9491
|
return {
|
|
9467
9492
|
manager: addr,
|
|
9468
|
-
proposalId: Number(
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9493
|
+
proposalId: Number(proposalId),
|
|
9494
|
+
totalPool: pool,
|
|
9495
|
+
totalClaimed: toBigInt(totalClaimed),
|
|
9496
|
+
merkleRoot,
|
|
9497
|
+
active: Boolean(active),
|
|
9498
|
+
finalized: Boolean(finalized),
|
|
9499
|
+
creator: creatorAddr
|
|
9474
9500
|
};
|
|
9475
9501
|
}
|
|
9476
|
-
function
|
|
9502
|
+
function buildMerkleCreateTx({ manager, proposalId, totalPool, amount }) {
|
|
9503
|
+
const addr = normalise(manager, "manager");
|
|
9504
|
+
const pool = totalPool ?? amount;
|
|
9505
|
+
const data = MerkleInterface.encodeFunctionData("createBoost", [Number(proposalId), BigInt(pool ?? 0n)]);
|
|
9506
|
+
return { to: addr, data, value: 0n };
|
|
9507
|
+
}
|
|
9508
|
+
function buildMerkleSetMerkleRootTx({ manager, proposalId, root, merkleRoot }) {
|
|
9509
|
+
const addr = normalise(manager, "manager");
|
|
9510
|
+
const nextRoot = root ?? merkleRoot;
|
|
9511
|
+
const data = MerkleInterface.encodeFunctionData("setMerkleRoot", [Number(proposalId), nextRoot]);
|
|
9512
|
+
return { to: addr, data, value: 0n };
|
|
9513
|
+
}
|
|
9514
|
+
function buildMerkleFinalizeTx({ manager, proposalId }) {
|
|
9477
9515
|
const addr = normalise(manager, "manager");
|
|
9478
|
-
const data = MerkleInterface.encodeFunctionData("
|
|
9516
|
+
const data = MerkleInterface.encodeFunctionData("finalize", [Number(proposalId)]);
|
|
9479
9517
|
return { to: addr, data, value: 0n };
|
|
9480
9518
|
}
|
|
9481
|
-
function
|
|
9519
|
+
function buildMerkleClaimTx({ manager, proposalId, account, amount, proof }) {
|
|
9482
9520
|
const addr = normalise(manager, "manager");
|
|
9483
|
-
const data = MerkleInterface.encodeFunctionData("
|
|
9521
|
+
const data = MerkleInterface.encodeFunctionData("claim", [
|
|
9522
|
+
Number(proposalId),
|
|
9523
|
+
normalise(account, "account"),
|
|
9524
|
+
BigInt(amount ?? 0n),
|
|
9525
|
+
proof || []
|
|
9526
|
+
]);
|
|
9484
9527
|
return { to: addr, data, value: 0n };
|
|
9485
9528
|
}
|
|
9486
|
-
async function
|
|
9529
|
+
async function getDirectBoost({ provider, manager, proposalId }) {
|
|
9487
9530
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
9488
9531
|
const addr = normalise(manager, "manager");
|
|
9489
9532
|
const contract = new Contract(addr, ABI.GovernanceBoostDirect, provider);
|
|
9490
|
-
const
|
|
9491
|
-
if (!
|
|
9533
|
+
const boost = await contract.getBoost(proposalId).catch(() => null);
|
|
9534
|
+
if (!boost) return null;
|
|
9535
|
+
const creatorAddr = boost.creator ? getAddress(boost.creator) : ZERO_ADDRESS;
|
|
9536
|
+
const pool = toBigInt(boost.totalPool);
|
|
9537
|
+
if (!boost.active && pool === 0n && creatorAddr === ZERO_ADDRESS) return null;
|
|
9492
9538
|
return {
|
|
9493
9539
|
manager: addr,
|
|
9494
|
-
proposalId: Number(
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9540
|
+
proposalId: Number(boost.proposalId ?? proposalId),
|
|
9541
|
+
creator: creatorAddr,
|
|
9542
|
+
governor: boost.governor ? getAddress(boost.governor) : null,
|
|
9543
|
+
snapshot: toBigInt(boost.snapshot),
|
|
9544
|
+
perVoter: toBigInt(boost.perVoter),
|
|
9545
|
+
maxVoters: toBigInt(boost.maxVoters),
|
|
9546
|
+
votersPaid: toBigInt(boost.votersPaid),
|
|
9547
|
+
minVotes: toBigInt(boost.minVotes),
|
|
9548
|
+
payoutMode: Number(boost.payoutMode ?? 0),
|
|
9549
|
+
support: Number(boost.support ?? 0),
|
|
9550
|
+
startAt: Number(boost.startAt ?? 0),
|
|
9551
|
+
expiresAt: Number(boost.expiresAt ?? 0),
|
|
9552
|
+
totalPool: pool,
|
|
9553
|
+
totalPaid: toBigInt(boost.totalPaid),
|
|
9554
|
+
kind: Number(boost.kind ?? 0),
|
|
9555
|
+
policy: boost.policy ? getAddress(boost.policy) : null,
|
|
9556
|
+
active: Boolean(boost.active),
|
|
9557
|
+
paused: Boolean(boost.paused)
|
|
9500
9558
|
};
|
|
9501
9559
|
}
|
|
9502
|
-
function buildDirectCreateTx({
|
|
9560
|
+
function buildDirectCreateTx({
|
|
9561
|
+
manager,
|
|
9562
|
+
governor,
|
|
9563
|
+
proposalId,
|
|
9564
|
+
perVoter,
|
|
9565
|
+
maxVoters,
|
|
9566
|
+
kind = 0,
|
|
9567
|
+
policy = ZERO_ADDRESS,
|
|
9568
|
+
minVotes = 0n,
|
|
9569
|
+
payoutMode = 0,
|
|
9570
|
+
support = 0,
|
|
9571
|
+
startAt = 0n,
|
|
9572
|
+
expiresAt = 0n
|
|
9573
|
+
}) {
|
|
9503
9574
|
const addr = normalise(manager, "manager");
|
|
9504
|
-
const
|
|
9505
|
-
|
|
9506
|
-
|
|
9575
|
+
const params = [
|
|
9576
|
+
normalise(governor, "governor"),
|
|
9577
|
+
BigInt(proposalId ?? 0n),
|
|
9507
9578
|
BigInt(perVoter ?? 0n),
|
|
9508
|
-
BigInt(maxVoters ?? 0n)
|
|
9509
|
-
|
|
9579
|
+
BigInt(maxVoters ?? 0n),
|
|
9580
|
+
Number(kind),
|
|
9581
|
+
policy ? normalise(policy, "policy") : ZERO_ADDRESS,
|
|
9582
|
+
BigInt(minVotes ?? 0n),
|
|
9583
|
+
Number(payoutMode),
|
|
9584
|
+
Number(support),
|
|
9585
|
+
BigInt(startAt ?? 0n),
|
|
9586
|
+
BigInt(expiresAt ?? 0n)
|
|
9587
|
+
];
|
|
9588
|
+
const data = DirectInterface.encodeFunctionData("createBoost", [params]);
|
|
9510
9589
|
return { to: addr, data, value: 0n };
|
|
9511
9590
|
}
|
|
9512
|
-
function
|
|
9591
|
+
function buildDirectClaimTx({ manager, proposalId, data = "0x" }) {
|
|
9513
9592
|
const addr = normalise(manager, "manager");
|
|
9514
|
-
const
|
|
9593
|
+
const callData = DirectInterface.encodeFunctionData("claim", [BigInt(proposalId ?? 0n), data]);
|
|
9594
|
+
return { to: addr, data: callData, value: 0n };
|
|
9595
|
+
}
|
|
9596
|
+
function buildDirectFinalizeTx({ manager, proposalId }) {
|
|
9597
|
+
const addr = normalise(manager, "manager");
|
|
9598
|
+
const data = DirectInterface.encodeFunctionData("finalize", [BigInt(proposalId ?? 0n)]);
|
|
9515
9599
|
return { to: addr, data, value: 0n };
|
|
9516
9600
|
}
|
|
9517
9601
|
module2.exports = {
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9602
|
+
// Merkle manager (GovernanceBoostManagerMerkle)
|
|
9603
|
+
getMerkleBoost,
|
|
9604
|
+
buildMerkleCreateTx,
|
|
9605
|
+
buildMerkleSetMerkleRootTx,
|
|
9606
|
+
buildMerkleFinalizeTx,
|
|
9607
|
+
buildMerkleClaimTx,
|
|
9608
|
+
// Legacy names (back-compat)
|
|
9609
|
+
getMerkleConfig: getMerkleBoost,
|
|
9610
|
+
buildMerkleFundTx: buildMerkleCreateTx,
|
|
9611
|
+
buildMerkleSetRootTx: buildMerkleSetMerkleRootTx,
|
|
9612
|
+
// Direct manager (GovernanceBoostManager)
|
|
9613
|
+
getDirectBoost,
|
|
9522
9614
|
buildDirectCreateTx,
|
|
9523
|
-
|
|
9615
|
+
buildDirectClaimTx,
|
|
9616
|
+
buildDirectFinalizeTx,
|
|
9617
|
+
// Legacy name (back-compat)
|
|
9618
|
+
getDirectConfig: getDirectBoost
|
|
9524
9619
|
};
|
|
9525
9620
|
}
|
|
9526
9621
|
});
|
|
@@ -12030,20 +12125,6 @@ ${error}` : ""}`;
|
|
|
12030
12125
|
const price = d[2].toString();
|
|
12031
12126
|
const manifest = d[3];
|
|
12032
12127
|
return { signature: sig, args: [hash, subdao, price, `"${manifest}"`] };
|
|
12033
|
-
} else if (data.startsWith(__require("ethers").id("setWrappedKey(bytes32,bytes,bytes32)").slice(0, 10))) {
|
|
12034
|
-
const { ethers: ethers2 } = __require("ethers");
|
|
12035
|
-
const sig = "setWrappedKey(bytes32,bytes,bytes32)";
|
|
12036
|
-
const iface = new ethers2.Interface([`function ${sig}`]);
|
|
12037
|
-
const d = iface.decodeFunctionData("setWrappedKey", data);
|
|
12038
|
-
const cidHash = d[0];
|
|
12039
|
-
const wrapped = d[1];
|
|
12040
|
-
const wrapperId = d[2];
|
|
12041
|
-
return { signature: sig, args: [cidHash, wrapped, wrapperId] };
|
|
12042
|
-
} else if (data.startsWith(__require("ethers").id("lockKey(bytes32)").slice(0, 10))) {
|
|
12043
|
-
const { ethers: ethers2 } = __require("ethers");
|
|
12044
|
-
const iface = new ethers2.Interface(["function lockKey(bytes32)"]);
|
|
12045
|
-
const d = iface.decodeFunctionData("lockKey", data);
|
|
12046
|
-
return { signature: "lockKey(bytes32)", args: [d[0]] };
|
|
12047
12128
|
} else if (data.startsWith(__require("ethers").id("claim(uint256,address,uint256,bytes32[])").slice(0, 10))) {
|
|
12048
12129
|
const { ethers: ethers2 } = __require("ethers");
|
|
12049
12130
|
const sig = "claim(uint256,address,uint256,bytes32[])";
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -558,6 +558,85 @@ export interface ManifestValidator {
|
|
|
558
558
|
bestPracticeCheckFile(manifestPath: string): Array<Record<string, any>>;
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
+
// ============================================================================
|
|
562
|
+
// Manifest + Skill Versioning Types (Phase 6)
|
|
563
|
+
// ============================================================================
|
|
564
|
+
|
|
565
|
+
export interface Provenance {
|
|
566
|
+
source: 'github' | 'local' | 'sage';
|
|
567
|
+
repo?: string;
|
|
568
|
+
path?: string;
|
|
569
|
+
ref?: string;
|
|
570
|
+
commit?: string;
|
|
571
|
+
importedAt?: string;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export interface PromptEntry {
|
|
575
|
+
key: string;
|
|
576
|
+
name?: string;
|
|
577
|
+
type?: 'prompt' | 'skill' | 'agent' | 'command' | 'template' | 'workflow';
|
|
578
|
+
cid?: string;
|
|
579
|
+
description?: string;
|
|
580
|
+
tags?: string[];
|
|
581
|
+
provenance?: Provenance;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export type UpstreamRef =
|
|
585
|
+
| { type: 'cid'; value: string }
|
|
586
|
+
| { type: 'github_commit'; value: { repo: string; commit: string } };
|
|
587
|
+
|
|
588
|
+
export interface SkillIndex {
|
|
589
|
+
key: string;
|
|
590
|
+
activeVersion: string;
|
|
591
|
+
previousVersion?: string;
|
|
592
|
+
pendingVersion?: string;
|
|
593
|
+
installedAt: string;
|
|
594
|
+
|
|
595
|
+
origin?: Origin;
|
|
596
|
+
|
|
597
|
+
lastChecked?: string;
|
|
598
|
+
latestUpstream?: UpstreamRef;
|
|
599
|
+
updateStatus?: 'up_to_date' | 'available' | 'removed' | 'check_failed';
|
|
600
|
+
|
|
601
|
+
versions: Record<string, {
|
|
602
|
+
upstream: UpstreamRef;
|
|
603
|
+
downloadedAt: string;
|
|
604
|
+
pinned?: boolean;
|
|
605
|
+
}>;
|
|
606
|
+
|
|
607
|
+
provenance?: Provenance;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export type Origin = OriginSage | OriginGithub;
|
|
611
|
+
|
|
612
|
+
export type OriginSage =
|
|
613
|
+
| {
|
|
614
|
+
type: 'sage';
|
|
615
|
+
tier: 'dao' | 'personal' | 'shared';
|
|
616
|
+
originKind: 'entry';
|
|
617
|
+
chainId: number;
|
|
618
|
+
owner: string;
|
|
619
|
+
libraryId: string;
|
|
620
|
+
manifestCid: string;
|
|
621
|
+
entryKey: string;
|
|
622
|
+
}
|
|
623
|
+
| {
|
|
624
|
+
type: 'sage';
|
|
625
|
+
tier: 'dao' | 'personal' | 'shared';
|
|
626
|
+
originKind: 'library';
|
|
627
|
+
chainId: number;
|
|
628
|
+
owner: string;
|
|
629
|
+
libraryId: string;
|
|
630
|
+
manifestCid: string;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
export interface OriginGithub {
|
|
634
|
+
type: 'github';
|
|
635
|
+
repo: string;
|
|
636
|
+
path: string;
|
|
637
|
+
ref?: string;
|
|
638
|
+
}
|
|
639
|
+
|
|
561
640
|
export interface LibrarySearchResult {
|
|
562
641
|
type: 'library' | 'prompt';
|
|
563
642
|
name: string;
|
|
@@ -740,29 +819,89 @@ export interface TreasuryModule {
|
|
|
740
819
|
getLPContribution(args: { provider: ProviderLike; treasury: AddressLike; subdao: AddressLike; token: AddressLike }): Promise<bigint>;
|
|
741
820
|
}
|
|
742
821
|
|
|
822
|
+
export interface MerkleBoost {
|
|
823
|
+
manager: AddressLike;
|
|
824
|
+
proposalId: number;
|
|
825
|
+
totalPool: bigint;
|
|
826
|
+
totalClaimed: bigint;
|
|
827
|
+
merkleRoot: HashLike;
|
|
828
|
+
active: boolean;
|
|
829
|
+
finalized: boolean;
|
|
830
|
+
creator: AddressLike;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export interface DirectBoost {
|
|
834
|
+
manager: AddressLike;
|
|
835
|
+
proposalId: number;
|
|
836
|
+
creator: AddressLike;
|
|
837
|
+
governor: AddressLike | null;
|
|
838
|
+
snapshot: bigint;
|
|
839
|
+
perVoter: bigint;
|
|
840
|
+
maxVoters: bigint;
|
|
841
|
+
votersPaid: bigint;
|
|
842
|
+
minVotes: bigint;
|
|
843
|
+
payoutMode: number;
|
|
844
|
+
support: number;
|
|
845
|
+
startAt: number;
|
|
846
|
+
expiresAt: number;
|
|
847
|
+
totalPool: bigint;
|
|
848
|
+
totalPaid: bigint;
|
|
849
|
+
kind: number;
|
|
850
|
+
policy: AddressLike | null;
|
|
851
|
+
active: boolean;
|
|
852
|
+
paused: boolean;
|
|
853
|
+
}
|
|
854
|
+
|
|
743
855
|
export interface BoostModule {
|
|
744
|
-
|
|
856
|
+
// Merkle manager (GovernanceBoostManagerMerkle)
|
|
857
|
+
getMerkleBoost(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<MerkleBoost | null>;
|
|
858
|
+
buildMerkleCreateTx(args: {
|
|
745
859
|
manager: AddressLike;
|
|
746
|
-
proposalId: number;
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
860
|
+
proposalId: number | bigint;
|
|
861
|
+
totalPool?: BigNumberish;
|
|
862
|
+
amount?: BigNumberish;
|
|
863
|
+
}): TransactionPayload;
|
|
864
|
+
buildMerkleSetMerkleRootTx(args: {
|
|
865
|
+
manager: AddressLike;
|
|
866
|
+
proposalId: number | bigint;
|
|
867
|
+
root?: HashLike;
|
|
868
|
+
merkleRoot?: HashLike;
|
|
869
|
+
}): TransactionPayload;
|
|
870
|
+
buildMerkleFinalizeTx(args: { manager: AddressLike; proposalId: number | bigint }): TransactionPayload;
|
|
871
|
+
buildMerkleClaimTx(args: {
|
|
872
|
+
manager: AddressLike;
|
|
873
|
+
proposalId: number | bigint;
|
|
874
|
+
account: AddressLike;
|
|
875
|
+
amount: BigNumberish;
|
|
876
|
+
proof: HashLike[];
|
|
877
|
+
}): TransactionPayload;
|
|
878
|
+
|
|
879
|
+
// Legacy names (back-compat)
|
|
880
|
+
getMerkleConfig(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<MerkleBoost | null>;
|
|
753
881
|
buildMerkleFundTx(args: { manager: AddressLike; proposalId: number | bigint; amount: BigNumberish }): TransactionPayload;
|
|
754
|
-
buildMerkleSetRootTx(args: { manager: AddressLike; proposalId: number | bigint; merkleRoot:
|
|
755
|
-
|
|
882
|
+
buildMerkleSetRootTx(args: { manager: AddressLike; proposalId: number | bigint; merkleRoot: HashLike }): TransactionPayload;
|
|
883
|
+
|
|
884
|
+
// Direct manager (GovernanceBoostManager)
|
|
885
|
+
getDirectBoost(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<DirectBoost | null>;
|
|
886
|
+
buildDirectCreateTx(args: {
|
|
756
887
|
manager: AddressLike;
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
perVoter:
|
|
760
|
-
maxVoters:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
888
|
+
governor: AddressLike;
|
|
889
|
+
proposalId: number | bigint;
|
|
890
|
+
perVoter: BigNumberish;
|
|
891
|
+
maxVoters: BigNumberish;
|
|
892
|
+
kind?: number;
|
|
893
|
+
policy?: AddressLike;
|
|
894
|
+
minVotes?: BigNumberish;
|
|
895
|
+
payoutMode?: number;
|
|
896
|
+
support?: number;
|
|
897
|
+
startAt?: BigNumberish;
|
|
898
|
+
expiresAt?: BigNumberish;
|
|
899
|
+
}): TransactionPayload;
|
|
900
|
+
buildDirectClaimTx(args: { manager: AddressLike; proposalId: number | bigint; data?: HashLike }): TransactionPayload;
|
|
901
|
+
buildDirectFinalizeTx(args: { manager: AddressLike; proposalId: number | bigint }): TransactionPayload;
|
|
902
|
+
|
|
903
|
+
// Legacy name (back-compat)
|
|
904
|
+
getDirectConfig(args: { provider: ProviderLike; manager: AddressLike; proposalId: number | bigint }): Promise<DirectBoost | null>;
|
|
766
905
|
}
|
|
767
906
|
|
|
768
907
|
export interface PersonalModule {
|