@sage-protocol/sdk 0.1.10 → 0.1.13
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 -2
- package/dist/browser/index.mjs +6 -1
- package/dist/index.cjs +118 -4
- package/dist/index.mjs +118 -4
- package/dist/node/index.cjs +118 -4
- package/dist/node/index.mjs +118 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -621,7 +621,7 @@ const totalByTag = await sdk.prompt.getByTagCount({ provider, registry, tagHash
|
|
|
621
621
|
const page = await sdk.prompt.listByTagPage({ provider, registry, tagHash, offset: 0, limit: 25 });
|
|
622
622
|
```
|
|
623
623
|
|
|
624
|
-
|
|
624
|
+
Team SubDAO helpers
|
|
625
625
|
```js
|
|
626
626
|
// One-click create + operatorize
|
|
627
627
|
const res = await sdk.subdao.createOperatorSubDAO({
|
|
@@ -629,7 +629,7 @@ const res = await sdk.subdao.createOperatorSubDAO({
|
|
|
629
629
|
factoryAddress: FACTORY,
|
|
630
630
|
operator: '0xSafeOrEOA',
|
|
631
631
|
name: 'My SubDAO',
|
|
632
|
-
description: '
|
|
632
|
+
description: 'Team controlled (Timelock + Safe/EOA executor)',
|
|
633
633
|
accessModel: 0,
|
|
634
634
|
minStakeAmount: 0n,
|
|
635
635
|
burnAmount: 1500n * 10n**18n,
|
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.1.
|
|
17
|
+
version: "0.1.12",
|
|
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",
|
|
@@ -154,6 +154,11 @@ var require_abi = __commonJS({
|
|
|
154
154
|
var FactoryWrite = [
|
|
155
155
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
156
156
|
"function createSubDAOWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
157
|
+
"function createSubDAOWithParams(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, uint256 votingDelay, uint256 votingPeriod, uint256 proposalThreshold, uint256 quorumPercentage, uint8 initialForkPolicy, uint8 initialMembershipPolicy, string profileCID) returns (address subDAO, address registry)",
|
|
158
|
+
"function createSubDAOOperatorWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
159
|
+
"function createSubDAOOperatorWithStableAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
160
|
+
"function createSubDAOOperator(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin) returns (address subDAO, address registry)",
|
|
161
|
+
"function createSubDAOOperatorAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer) returns (address subDAO, address registry)",
|
|
157
162
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
158
163
|
"function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)"
|
|
159
164
|
];
|
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.1.
|
|
17
|
+
version: "0.1.12",
|
|
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",
|
|
@@ -154,6 +154,11 @@ var require_abi = __commonJS({
|
|
|
154
154
|
var FactoryWrite = [
|
|
155
155
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
156
156
|
"function createSubDAOWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
157
|
+
"function createSubDAOWithParams(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, uint256 votingDelay, uint256 votingPeriod, uint256 proposalThreshold, uint256 quorumPercentage, uint8 initialForkPolicy, uint8 initialMembershipPolicy, string profileCID) returns (address subDAO, address registry)",
|
|
158
|
+
"function createSubDAOOperatorWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
159
|
+
"function createSubDAOOperatorWithStableAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
160
|
+
"function createSubDAOOperator(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin) returns (address subDAO, address registry)",
|
|
161
|
+
"function createSubDAOOperatorAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer) returns (address subDAO, address registry)",
|
|
157
162
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
158
163
|
"function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)"
|
|
159
164
|
];
|
|
@@ -2516,7 +2521,7 @@ var require_governance = __commonJS({
|
|
|
2516
2521
|
/**
|
|
2517
2522
|
* Detect governance mode and operator status.
|
|
2518
2523
|
* Heuristics mirror CLI detectGovMode.
|
|
2519
|
-
* Returns { operator: boolean, governance: '
|
|
2524
|
+
* Returns { operator: boolean, governance: 'Personal'|'Community'|'Unknown', governor, timelock, subdao, stakeRequired, depositWei }
|
|
2520
2525
|
*/
|
|
2521
2526
|
detectMode: async function detectMode({ provider, governor, timelock: timelock2, subdao: subdao2 }) {
|
|
2522
2527
|
const out = {
|
|
@@ -2536,7 +2541,7 @@ var require_governance = __commonJS({
|
|
|
2536
2541
|
if (!timelock2) out.timelock = await sub.timelock();
|
|
2537
2542
|
try {
|
|
2538
2543
|
const mode = await sub.getGovernanceMode();
|
|
2539
|
-
out.governance = Number(mode) === 0 ? "
|
|
2544
|
+
out.governance = Number(mode) === 0 ? "Personal" : "Community";
|
|
2540
2545
|
} catch (_) {
|
|
2541
2546
|
}
|
|
2542
2547
|
}
|
|
@@ -3981,7 +3986,17 @@ var require_factory = __commonJS({
|
|
|
3981
3986
|
] = await Promise.all([
|
|
3982
3987
|
contract.stableFeeToken().catch(() => null),
|
|
3983
3988
|
contract.stableCreationFee().catch(() => null),
|
|
3984
|
-
|
|
3989
|
+
(async () => {
|
|
3990
|
+
try {
|
|
3991
|
+
return await contract.stableFeeReceiver();
|
|
3992
|
+
} catch (_) {
|
|
3993
|
+
try {
|
|
3994
|
+
return await contract.feeReceiver();
|
|
3995
|
+
} catch {
|
|
3996
|
+
return null;
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
})(),
|
|
3985
4000
|
contract.allowStableFee().catch(() => null),
|
|
3986
4001
|
contract.stablePromptForkFee().catch(() => null),
|
|
3987
4002
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4148,6 +4163,102 @@ var require_factory = __commonJS({
|
|
|
4148
4163
|
]);
|
|
4149
4164
|
return { to: addr, data: payload, value: 0n };
|
|
4150
4165
|
}
|
|
4166
|
+
function buildCreateSubDAOWithParamsTx({
|
|
4167
|
+
factory: factory2,
|
|
4168
|
+
name,
|
|
4169
|
+
description,
|
|
4170
|
+
accessModel,
|
|
4171
|
+
minStakeAmount,
|
|
4172
|
+
burnAmount,
|
|
4173
|
+
votingDelay,
|
|
4174
|
+
votingPeriod,
|
|
4175
|
+
proposalThreshold,
|
|
4176
|
+
quorumPercentage,
|
|
4177
|
+
initialForkPolicy,
|
|
4178
|
+
initialMembershipPolicy,
|
|
4179
|
+
profileCID
|
|
4180
|
+
}) {
|
|
4181
|
+
const addr = normalise(factory2, "factory");
|
|
4182
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOWithParams", [
|
|
4183
|
+
String(name),
|
|
4184
|
+
String(description),
|
|
4185
|
+
Number(accessModel),
|
|
4186
|
+
BigInt(minStakeAmount),
|
|
4187
|
+
BigInt(burnAmount),
|
|
4188
|
+
BigInt(votingDelay),
|
|
4189
|
+
BigInt(votingPeriod),
|
|
4190
|
+
BigInt(proposalThreshold),
|
|
4191
|
+
BigInt(quorumPercentage),
|
|
4192
|
+
Number(initialForkPolicy),
|
|
4193
|
+
Number(initialMembershipPolicy),
|
|
4194
|
+
String(profileCID ?? "")
|
|
4195
|
+
]);
|
|
4196
|
+
return { to: addr, data: payload, value: 0n };
|
|
4197
|
+
}
|
|
4198
|
+
function buildCreateOperatorSubDAOWithStableTx({
|
|
4199
|
+
factory: factory2,
|
|
4200
|
+
name,
|
|
4201
|
+
description,
|
|
4202
|
+
accessModel,
|
|
4203
|
+
minStakeAmount,
|
|
4204
|
+
operatorExecutor,
|
|
4205
|
+
operatorAdmin,
|
|
4206
|
+
permit
|
|
4207
|
+
}) {
|
|
4208
|
+
const addr = normalise(factory2, "factory");
|
|
4209
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4210
|
+
const tuple = [
|
|
4211
|
+
BigInt(permit.value ?? 0n),
|
|
4212
|
+
BigInt(permit.deadline ?? 0n),
|
|
4213
|
+
Number(permit.v ?? 0),
|
|
4214
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4215
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4216
|
+
];
|
|
4217
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStable", [
|
|
4218
|
+
String(name),
|
|
4219
|
+
String(description),
|
|
4220
|
+
Number(accessModel),
|
|
4221
|
+
BigInt(minStakeAmount),
|
|
4222
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4223
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4224
|
+
tuple
|
|
4225
|
+
]);
|
|
4226
|
+
return { to: addr, data: payload, value: 0n };
|
|
4227
|
+
}
|
|
4228
|
+
function buildCreateOperatorSubDAOWithStableAdvancedTx({
|
|
4229
|
+
factory: factory2,
|
|
4230
|
+
name,
|
|
4231
|
+
description,
|
|
4232
|
+
accessModel,
|
|
4233
|
+
minStakeAmount,
|
|
4234
|
+
operatorExecutor,
|
|
4235
|
+
operatorAdmin,
|
|
4236
|
+
anyoneExec = false,
|
|
4237
|
+
governorProposer = false,
|
|
4238
|
+
permit
|
|
4239
|
+
}) {
|
|
4240
|
+
const addr = normalise(factory2, "factory");
|
|
4241
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4242
|
+
const tuple = [
|
|
4243
|
+
BigInt(permit.value ?? 0n),
|
|
4244
|
+
BigInt(permit.deadline ?? 0n),
|
|
4245
|
+
Number(permit.v ?? 0),
|
|
4246
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4247
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4248
|
+
];
|
|
4249
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStableAdvanced", [
|
|
4250
|
+
String(name),
|
|
4251
|
+
String(description),
|
|
4252
|
+
Number(accessModel),
|
|
4253
|
+
BigInt(minStakeAmount),
|
|
4254
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4255
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4256
|
+
Boolean(anyoneExec),
|
|
4257
|
+
Boolean(governorProposer),
|
|
4258
|
+
tuple
|
|
4259
|
+
]);
|
|
4260
|
+
return { to: addr, data: payload, value: 0n };
|
|
4261
|
+
}
|
|
4151
4262
|
async function listSubDAOs({ provider, factory: factory2 }) {
|
|
4152
4263
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4153
4264
|
const addr = normalise(factory2, "factory");
|
|
@@ -4228,6 +4339,9 @@ var require_factory = __commonJS({
|
|
|
4228
4339
|
getTemplateDetails,
|
|
4229
4340
|
buildCreateSubDAOTx,
|
|
4230
4341
|
buildCreateSubDAOWithStableTx,
|
|
4342
|
+
buildCreateSubDAOWithParamsTx,
|
|
4343
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4344
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4231
4345
|
buildCreateForkedSubDAOTx,
|
|
4232
4346
|
buildCreateForkedSubDAOWithStableTx
|
|
4233
4347
|
};
|
package/dist/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.1.
|
|
23
|
+
version: "0.1.12",
|
|
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",
|
|
@@ -160,6 +160,11 @@ var require_abi = __commonJS({
|
|
|
160
160
|
var FactoryWrite = [
|
|
161
161
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
162
162
|
"function createSubDAOWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
163
|
+
"function createSubDAOWithParams(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, uint256 votingDelay, uint256 votingPeriod, uint256 proposalThreshold, uint256 quorumPercentage, uint8 initialForkPolicy, uint8 initialMembershipPolicy, string profileCID) returns (address subDAO, address registry)",
|
|
164
|
+
"function createSubDAOOperatorWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
165
|
+
"function createSubDAOOperatorWithStableAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
166
|
+
"function createSubDAOOperator(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin) returns (address subDAO, address registry)",
|
|
167
|
+
"function createSubDAOOperatorAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer) returns (address subDAO, address registry)",
|
|
163
168
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
164
169
|
"function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)"
|
|
165
170
|
];
|
|
@@ -2522,7 +2527,7 @@ var require_governance = __commonJS({
|
|
|
2522
2527
|
/**
|
|
2523
2528
|
* Detect governance mode and operator status.
|
|
2524
2529
|
* Heuristics mirror CLI detectGovMode.
|
|
2525
|
-
* Returns { operator: boolean, governance: '
|
|
2530
|
+
* Returns { operator: boolean, governance: 'Personal'|'Community'|'Unknown', governor, timelock, subdao, stakeRequired, depositWei }
|
|
2526
2531
|
*/
|
|
2527
2532
|
detectMode: async function detectMode({ provider, governor, timelock, subdao }) {
|
|
2528
2533
|
const out = {
|
|
@@ -2542,7 +2547,7 @@ var require_governance = __commonJS({
|
|
|
2542
2547
|
if (!timelock) out.timelock = await sub.timelock();
|
|
2543
2548
|
try {
|
|
2544
2549
|
const mode = await sub.getGovernanceMode();
|
|
2545
|
-
out.governance = Number(mode) === 0 ? "
|
|
2550
|
+
out.governance = Number(mode) === 0 ? "Personal" : "Community";
|
|
2546
2551
|
} catch (_) {
|
|
2547
2552
|
}
|
|
2548
2553
|
}
|
|
@@ -3987,7 +3992,17 @@ var require_factory = __commonJS({
|
|
|
3987
3992
|
] = await Promise.all([
|
|
3988
3993
|
contract.stableFeeToken().catch(() => null),
|
|
3989
3994
|
contract.stableCreationFee().catch(() => null),
|
|
3990
|
-
|
|
3995
|
+
(async () => {
|
|
3996
|
+
try {
|
|
3997
|
+
return await contract.stableFeeReceiver();
|
|
3998
|
+
} catch (_) {
|
|
3999
|
+
try {
|
|
4000
|
+
return await contract.feeReceiver();
|
|
4001
|
+
} catch {
|
|
4002
|
+
return null;
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
})(),
|
|
3991
4006
|
contract.allowStableFee().catch(() => null),
|
|
3992
4007
|
contract.stablePromptForkFee().catch(() => null),
|
|
3993
4008
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4154,6 +4169,102 @@ var require_factory = __commonJS({
|
|
|
4154
4169
|
]);
|
|
4155
4170
|
return { to: addr, data: payload, value: 0n };
|
|
4156
4171
|
}
|
|
4172
|
+
function buildCreateSubDAOWithParamsTx({
|
|
4173
|
+
factory,
|
|
4174
|
+
name,
|
|
4175
|
+
description,
|
|
4176
|
+
accessModel,
|
|
4177
|
+
minStakeAmount,
|
|
4178
|
+
burnAmount,
|
|
4179
|
+
votingDelay,
|
|
4180
|
+
votingPeriod,
|
|
4181
|
+
proposalThreshold,
|
|
4182
|
+
quorumPercentage,
|
|
4183
|
+
initialForkPolicy,
|
|
4184
|
+
initialMembershipPolicy,
|
|
4185
|
+
profileCID
|
|
4186
|
+
}) {
|
|
4187
|
+
const addr = normalise(factory, "factory");
|
|
4188
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOWithParams", [
|
|
4189
|
+
String(name),
|
|
4190
|
+
String(description),
|
|
4191
|
+
Number(accessModel),
|
|
4192
|
+
BigInt(minStakeAmount),
|
|
4193
|
+
BigInt(burnAmount),
|
|
4194
|
+
BigInt(votingDelay),
|
|
4195
|
+
BigInt(votingPeriod),
|
|
4196
|
+
BigInt(proposalThreshold),
|
|
4197
|
+
BigInt(quorumPercentage),
|
|
4198
|
+
Number(initialForkPolicy),
|
|
4199
|
+
Number(initialMembershipPolicy),
|
|
4200
|
+
String(profileCID ?? "")
|
|
4201
|
+
]);
|
|
4202
|
+
return { to: addr, data: payload, value: 0n };
|
|
4203
|
+
}
|
|
4204
|
+
function buildCreateOperatorSubDAOWithStableTx({
|
|
4205
|
+
factory,
|
|
4206
|
+
name,
|
|
4207
|
+
description,
|
|
4208
|
+
accessModel,
|
|
4209
|
+
minStakeAmount,
|
|
4210
|
+
operatorExecutor,
|
|
4211
|
+
operatorAdmin,
|
|
4212
|
+
permit
|
|
4213
|
+
}) {
|
|
4214
|
+
const addr = normalise(factory, "factory");
|
|
4215
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4216
|
+
const tuple = [
|
|
4217
|
+
BigInt(permit.value ?? 0n),
|
|
4218
|
+
BigInt(permit.deadline ?? 0n),
|
|
4219
|
+
Number(permit.v ?? 0),
|
|
4220
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4221
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4222
|
+
];
|
|
4223
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStable", [
|
|
4224
|
+
String(name),
|
|
4225
|
+
String(description),
|
|
4226
|
+
Number(accessModel),
|
|
4227
|
+
BigInt(minStakeAmount),
|
|
4228
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4229
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4230
|
+
tuple
|
|
4231
|
+
]);
|
|
4232
|
+
return { to: addr, data: payload, value: 0n };
|
|
4233
|
+
}
|
|
4234
|
+
function buildCreateOperatorSubDAOWithStableAdvancedTx({
|
|
4235
|
+
factory,
|
|
4236
|
+
name,
|
|
4237
|
+
description,
|
|
4238
|
+
accessModel,
|
|
4239
|
+
minStakeAmount,
|
|
4240
|
+
operatorExecutor,
|
|
4241
|
+
operatorAdmin,
|
|
4242
|
+
anyoneExec = false,
|
|
4243
|
+
governorProposer = false,
|
|
4244
|
+
permit
|
|
4245
|
+
}) {
|
|
4246
|
+
const addr = normalise(factory, "factory");
|
|
4247
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4248
|
+
const tuple = [
|
|
4249
|
+
BigInt(permit.value ?? 0n),
|
|
4250
|
+
BigInt(permit.deadline ?? 0n),
|
|
4251
|
+
Number(permit.v ?? 0),
|
|
4252
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4253
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4254
|
+
];
|
|
4255
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStableAdvanced", [
|
|
4256
|
+
String(name),
|
|
4257
|
+
String(description),
|
|
4258
|
+
Number(accessModel),
|
|
4259
|
+
BigInt(minStakeAmount),
|
|
4260
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4261
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4262
|
+
Boolean(anyoneExec),
|
|
4263
|
+
Boolean(governorProposer),
|
|
4264
|
+
tuple
|
|
4265
|
+
]);
|
|
4266
|
+
return { to: addr, data: payload, value: 0n };
|
|
4267
|
+
}
|
|
4157
4268
|
async function listSubDAOs({ provider, factory }) {
|
|
4158
4269
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4159
4270
|
const addr = normalise(factory, "factory");
|
|
@@ -4234,6 +4345,9 @@ var require_factory = __commonJS({
|
|
|
4234
4345
|
getTemplateDetails,
|
|
4235
4346
|
buildCreateSubDAOTx,
|
|
4236
4347
|
buildCreateSubDAOWithStableTx,
|
|
4348
|
+
buildCreateSubDAOWithParamsTx,
|
|
4349
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4350
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4237
4351
|
buildCreateForkedSubDAOTx,
|
|
4238
4352
|
buildCreateForkedSubDAOWithStableTx
|
|
4239
4353
|
};
|
package/dist/node/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.1.
|
|
17
|
+
version: "0.1.12",
|
|
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",
|
|
@@ -154,6 +154,11 @@ var require_abi = __commonJS({
|
|
|
154
154
|
var FactoryWrite = [
|
|
155
155
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
156
156
|
"function createSubDAOWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
157
|
+
"function createSubDAOWithParams(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, uint256 votingDelay, uint256 votingPeriod, uint256 proposalThreshold, uint256 quorumPercentage, uint8 initialForkPolicy, uint8 initialMembershipPolicy, string profileCID) returns (address subDAO, address registry)",
|
|
158
|
+
"function createSubDAOOperatorWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
159
|
+
"function createSubDAOOperatorWithStableAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
160
|
+
"function createSubDAOOperator(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin) returns (address subDAO, address registry)",
|
|
161
|
+
"function createSubDAOOperatorAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer) returns (address subDAO, address registry)",
|
|
157
162
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
158
163
|
"function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)"
|
|
159
164
|
];
|
|
@@ -2516,7 +2521,7 @@ var require_governance = __commonJS({
|
|
|
2516
2521
|
/**
|
|
2517
2522
|
* Detect governance mode and operator status.
|
|
2518
2523
|
* Heuristics mirror CLI detectGovMode.
|
|
2519
|
-
* Returns { operator: boolean, governance: '
|
|
2524
|
+
* Returns { operator: boolean, governance: 'Personal'|'Community'|'Unknown', governor, timelock, subdao, stakeRequired, depositWei }
|
|
2520
2525
|
*/
|
|
2521
2526
|
detectMode: async function detectMode({ provider, governor, timelock, subdao }) {
|
|
2522
2527
|
const out = {
|
|
@@ -2536,7 +2541,7 @@ var require_governance = __commonJS({
|
|
|
2536
2541
|
if (!timelock) out.timelock = await sub.timelock();
|
|
2537
2542
|
try {
|
|
2538
2543
|
const mode = await sub.getGovernanceMode();
|
|
2539
|
-
out.governance = Number(mode) === 0 ? "
|
|
2544
|
+
out.governance = Number(mode) === 0 ? "Personal" : "Community";
|
|
2540
2545
|
} catch (_) {
|
|
2541
2546
|
}
|
|
2542
2547
|
}
|
|
@@ -3981,7 +3986,17 @@ var require_factory = __commonJS({
|
|
|
3981
3986
|
] = await Promise.all([
|
|
3982
3987
|
contract.stableFeeToken().catch(() => null),
|
|
3983
3988
|
contract.stableCreationFee().catch(() => null),
|
|
3984
|
-
|
|
3989
|
+
(async () => {
|
|
3990
|
+
try {
|
|
3991
|
+
return await contract.stableFeeReceiver();
|
|
3992
|
+
} catch (_) {
|
|
3993
|
+
try {
|
|
3994
|
+
return await contract.feeReceiver();
|
|
3995
|
+
} catch {
|
|
3996
|
+
return null;
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
})(),
|
|
3985
4000
|
contract.allowStableFee().catch(() => null),
|
|
3986
4001
|
contract.stablePromptForkFee().catch(() => null),
|
|
3987
4002
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4148,6 +4163,102 @@ var require_factory = __commonJS({
|
|
|
4148
4163
|
]);
|
|
4149
4164
|
return { to: addr, data: payload, value: 0n };
|
|
4150
4165
|
}
|
|
4166
|
+
function buildCreateSubDAOWithParamsTx({
|
|
4167
|
+
factory,
|
|
4168
|
+
name,
|
|
4169
|
+
description,
|
|
4170
|
+
accessModel,
|
|
4171
|
+
minStakeAmount,
|
|
4172
|
+
burnAmount,
|
|
4173
|
+
votingDelay,
|
|
4174
|
+
votingPeriod,
|
|
4175
|
+
proposalThreshold,
|
|
4176
|
+
quorumPercentage,
|
|
4177
|
+
initialForkPolicy,
|
|
4178
|
+
initialMembershipPolicy,
|
|
4179
|
+
profileCID
|
|
4180
|
+
}) {
|
|
4181
|
+
const addr = normalise(factory, "factory");
|
|
4182
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOWithParams", [
|
|
4183
|
+
String(name),
|
|
4184
|
+
String(description),
|
|
4185
|
+
Number(accessModel),
|
|
4186
|
+
BigInt(minStakeAmount),
|
|
4187
|
+
BigInt(burnAmount),
|
|
4188
|
+
BigInt(votingDelay),
|
|
4189
|
+
BigInt(votingPeriod),
|
|
4190
|
+
BigInt(proposalThreshold),
|
|
4191
|
+
BigInt(quorumPercentage),
|
|
4192
|
+
Number(initialForkPolicy),
|
|
4193
|
+
Number(initialMembershipPolicy),
|
|
4194
|
+
String(profileCID ?? "")
|
|
4195
|
+
]);
|
|
4196
|
+
return { to: addr, data: payload, value: 0n };
|
|
4197
|
+
}
|
|
4198
|
+
function buildCreateOperatorSubDAOWithStableTx({
|
|
4199
|
+
factory,
|
|
4200
|
+
name,
|
|
4201
|
+
description,
|
|
4202
|
+
accessModel,
|
|
4203
|
+
minStakeAmount,
|
|
4204
|
+
operatorExecutor,
|
|
4205
|
+
operatorAdmin,
|
|
4206
|
+
permit
|
|
4207
|
+
}) {
|
|
4208
|
+
const addr = normalise(factory, "factory");
|
|
4209
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4210
|
+
const tuple = [
|
|
4211
|
+
BigInt(permit.value ?? 0n),
|
|
4212
|
+
BigInt(permit.deadline ?? 0n),
|
|
4213
|
+
Number(permit.v ?? 0),
|
|
4214
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4215
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4216
|
+
];
|
|
4217
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStable", [
|
|
4218
|
+
String(name),
|
|
4219
|
+
String(description),
|
|
4220
|
+
Number(accessModel),
|
|
4221
|
+
BigInt(minStakeAmount),
|
|
4222
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4223
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4224
|
+
tuple
|
|
4225
|
+
]);
|
|
4226
|
+
return { to: addr, data: payload, value: 0n };
|
|
4227
|
+
}
|
|
4228
|
+
function buildCreateOperatorSubDAOWithStableAdvancedTx({
|
|
4229
|
+
factory,
|
|
4230
|
+
name,
|
|
4231
|
+
description,
|
|
4232
|
+
accessModel,
|
|
4233
|
+
minStakeAmount,
|
|
4234
|
+
operatorExecutor,
|
|
4235
|
+
operatorAdmin,
|
|
4236
|
+
anyoneExec = false,
|
|
4237
|
+
governorProposer = false,
|
|
4238
|
+
permit
|
|
4239
|
+
}) {
|
|
4240
|
+
const addr = normalise(factory, "factory");
|
|
4241
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4242
|
+
const tuple = [
|
|
4243
|
+
BigInt(permit.value ?? 0n),
|
|
4244
|
+
BigInt(permit.deadline ?? 0n),
|
|
4245
|
+
Number(permit.v ?? 0),
|
|
4246
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4247
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4248
|
+
];
|
|
4249
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStableAdvanced", [
|
|
4250
|
+
String(name),
|
|
4251
|
+
String(description),
|
|
4252
|
+
Number(accessModel),
|
|
4253
|
+
BigInt(minStakeAmount),
|
|
4254
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4255
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4256
|
+
Boolean(anyoneExec),
|
|
4257
|
+
Boolean(governorProposer),
|
|
4258
|
+
tuple
|
|
4259
|
+
]);
|
|
4260
|
+
return { to: addr, data: payload, value: 0n };
|
|
4261
|
+
}
|
|
4151
4262
|
async function listSubDAOs({ provider, factory }) {
|
|
4152
4263
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4153
4264
|
const addr = normalise(factory, "factory");
|
|
@@ -4228,6 +4339,9 @@ var require_factory = __commonJS({
|
|
|
4228
4339
|
getTemplateDetails,
|
|
4229
4340
|
buildCreateSubDAOTx,
|
|
4230
4341
|
buildCreateSubDAOWithStableTx,
|
|
4342
|
+
buildCreateSubDAOWithParamsTx,
|
|
4343
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4344
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4231
4345
|
buildCreateForkedSubDAOTx,
|
|
4232
4346
|
buildCreateForkedSubDAOWithStableTx
|
|
4233
4347
|
};
|
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.1.
|
|
23
|
+
version: "0.1.12",
|
|
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",
|
|
@@ -160,6 +160,11 @@ var require_abi = __commonJS({
|
|
|
160
160
|
var FactoryWrite = [
|
|
161
161
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
162
162
|
"function createSubDAOWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
163
|
+
"function createSubDAOWithParams(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, uint256 votingDelay, uint256 votingPeriod, uint256 proposalThreshold, uint256 quorumPercentage, uint8 initialForkPolicy, uint8 initialMembershipPolicy, string profileCID) returns (address subDAO, address registry)",
|
|
164
|
+
"function createSubDAOOperatorWithStable(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
165
|
+
"function createSubDAOOperatorWithStableAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)",
|
|
166
|
+
"function createSubDAOOperator(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin) returns (address subDAO, address registry)",
|
|
167
|
+
"function createSubDAOOperatorAdvanced(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount, address operatorExecutor, address operatorAdmin, bool anyoneExec, bool governorProposer) returns (address subDAO, address registry)",
|
|
163
168
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
164
169
|
"function createForkedSubDAOWithStable(string newName, string newDescription, string originalName, address originalSubDAO, address forker, uint64 authorizationNonce, (uint256 value,uint256 deadline,uint8 v,bytes32 r,bytes32 s) permit) returns (address subDAO, address registry)"
|
|
165
170
|
];
|
|
@@ -2522,7 +2527,7 @@ var require_governance = __commonJS({
|
|
|
2522
2527
|
/**
|
|
2523
2528
|
* Detect governance mode and operator status.
|
|
2524
2529
|
* Heuristics mirror CLI detectGovMode.
|
|
2525
|
-
* Returns { operator: boolean, governance: '
|
|
2530
|
+
* Returns { operator: boolean, governance: 'Personal'|'Community'|'Unknown', governor, timelock, subdao, stakeRequired, depositWei }
|
|
2526
2531
|
*/
|
|
2527
2532
|
detectMode: async function detectMode({ provider, governor, timelock, subdao }) {
|
|
2528
2533
|
const out = {
|
|
@@ -2542,7 +2547,7 @@ var require_governance = __commonJS({
|
|
|
2542
2547
|
if (!timelock) out.timelock = await sub.timelock();
|
|
2543
2548
|
try {
|
|
2544
2549
|
const mode = await sub.getGovernanceMode();
|
|
2545
|
-
out.governance = Number(mode) === 0 ? "
|
|
2550
|
+
out.governance = Number(mode) === 0 ? "Personal" : "Community";
|
|
2546
2551
|
} catch (_) {
|
|
2547
2552
|
}
|
|
2548
2553
|
}
|
|
@@ -3987,7 +3992,17 @@ var require_factory = __commonJS({
|
|
|
3987
3992
|
] = await Promise.all([
|
|
3988
3993
|
contract.stableFeeToken().catch(() => null),
|
|
3989
3994
|
contract.stableCreationFee().catch(() => null),
|
|
3990
|
-
|
|
3995
|
+
(async () => {
|
|
3996
|
+
try {
|
|
3997
|
+
return await contract.stableFeeReceiver();
|
|
3998
|
+
} catch (_) {
|
|
3999
|
+
try {
|
|
4000
|
+
return await contract.feeReceiver();
|
|
4001
|
+
} catch {
|
|
4002
|
+
return null;
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
})(),
|
|
3991
4006
|
contract.allowStableFee().catch(() => null),
|
|
3992
4007
|
contract.stablePromptForkFee().catch(() => null),
|
|
3993
4008
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4154,6 +4169,102 @@ var require_factory = __commonJS({
|
|
|
4154
4169
|
]);
|
|
4155
4170
|
return { to: addr, data: payload, value: 0n };
|
|
4156
4171
|
}
|
|
4172
|
+
function buildCreateSubDAOWithParamsTx({
|
|
4173
|
+
factory,
|
|
4174
|
+
name,
|
|
4175
|
+
description,
|
|
4176
|
+
accessModel,
|
|
4177
|
+
minStakeAmount,
|
|
4178
|
+
burnAmount,
|
|
4179
|
+
votingDelay,
|
|
4180
|
+
votingPeriod,
|
|
4181
|
+
proposalThreshold,
|
|
4182
|
+
quorumPercentage,
|
|
4183
|
+
initialForkPolicy,
|
|
4184
|
+
initialMembershipPolicy,
|
|
4185
|
+
profileCID
|
|
4186
|
+
}) {
|
|
4187
|
+
const addr = normalise(factory, "factory");
|
|
4188
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOWithParams", [
|
|
4189
|
+
String(name),
|
|
4190
|
+
String(description),
|
|
4191
|
+
Number(accessModel),
|
|
4192
|
+
BigInt(minStakeAmount),
|
|
4193
|
+
BigInt(burnAmount),
|
|
4194
|
+
BigInt(votingDelay),
|
|
4195
|
+
BigInt(votingPeriod),
|
|
4196
|
+
BigInt(proposalThreshold),
|
|
4197
|
+
BigInt(quorumPercentage),
|
|
4198
|
+
Number(initialForkPolicy),
|
|
4199
|
+
Number(initialMembershipPolicy),
|
|
4200
|
+
String(profileCID ?? "")
|
|
4201
|
+
]);
|
|
4202
|
+
return { to: addr, data: payload, value: 0n };
|
|
4203
|
+
}
|
|
4204
|
+
function buildCreateOperatorSubDAOWithStableTx({
|
|
4205
|
+
factory,
|
|
4206
|
+
name,
|
|
4207
|
+
description,
|
|
4208
|
+
accessModel,
|
|
4209
|
+
minStakeAmount,
|
|
4210
|
+
operatorExecutor,
|
|
4211
|
+
operatorAdmin,
|
|
4212
|
+
permit
|
|
4213
|
+
}) {
|
|
4214
|
+
const addr = normalise(factory, "factory");
|
|
4215
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4216
|
+
const tuple = [
|
|
4217
|
+
BigInt(permit.value ?? 0n),
|
|
4218
|
+
BigInt(permit.deadline ?? 0n),
|
|
4219
|
+
Number(permit.v ?? 0),
|
|
4220
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4221
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4222
|
+
];
|
|
4223
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStable", [
|
|
4224
|
+
String(name),
|
|
4225
|
+
String(description),
|
|
4226
|
+
Number(accessModel),
|
|
4227
|
+
BigInt(minStakeAmount),
|
|
4228
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4229
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4230
|
+
tuple
|
|
4231
|
+
]);
|
|
4232
|
+
return { to: addr, data: payload, value: 0n };
|
|
4233
|
+
}
|
|
4234
|
+
function buildCreateOperatorSubDAOWithStableAdvancedTx({
|
|
4235
|
+
factory,
|
|
4236
|
+
name,
|
|
4237
|
+
description,
|
|
4238
|
+
accessModel,
|
|
4239
|
+
minStakeAmount,
|
|
4240
|
+
operatorExecutor,
|
|
4241
|
+
operatorAdmin,
|
|
4242
|
+
anyoneExec = false,
|
|
4243
|
+
governorProposer = false,
|
|
4244
|
+
permit
|
|
4245
|
+
}) {
|
|
4246
|
+
const addr = normalise(factory, "factory");
|
|
4247
|
+
if (!permit) throw new SageSDKError(CODES.INVALID_ARGS, "permit required for operator stable creation");
|
|
4248
|
+
const tuple = [
|
|
4249
|
+
BigInt(permit.value ?? 0n),
|
|
4250
|
+
BigInt(permit.deadline ?? 0n),
|
|
4251
|
+
Number(permit.v ?? 0),
|
|
4252
|
+
permit.r ?? "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4253
|
+
permit.s ?? "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
4254
|
+
];
|
|
4255
|
+
const payload = FactoryWriteInterface.encodeFunctionData("createSubDAOOperatorWithStableAdvanced", [
|
|
4256
|
+
String(name),
|
|
4257
|
+
String(description),
|
|
4258
|
+
Number(accessModel),
|
|
4259
|
+
BigInt(minStakeAmount),
|
|
4260
|
+
normalise(operatorExecutor, "operatorExecutor"),
|
|
4261
|
+
normalise(operatorAdmin, "operatorAdmin"),
|
|
4262
|
+
Boolean(anyoneExec),
|
|
4263
|
+
Boolean(governorProposer),
|
|
4264
|
+
tuple
|
|
4265
|
+
]);
|
|
4266
|
+
return { to: addr, data: payload, value: 0n };
|
|
4267
|
+
}
|
|
4157
4268
|
async function listSubDAOs({ provider, factory }) {
|
|
4158
4269
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4159
4270
|
const addr = normalise(factory, "factory");
|
|
@@ -4234,6 +4345,9 @@ var require_factory = __commonJS({
|
|
|
4234
4345
|
getTemplateDetails,
|
|
4235
4346
|
buildCreateSubDAOTx,
|
|
4236
4347
|
buildCreateSubDAOWithStableTx,
|
|
4348
|
+
buildCreateSubDAOWithParamsTx,
|
|
4349
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4350
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4237
4351
|
buildCreateForkedSubDAOTx,
|
|
4238
4352
|
buildCreateForkedSubDAOWithStableTx
|
|
4239
4353
|
};
|
package/package.json
CHANGED