@sage-protocol/sdk 0.1.11 → 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 +13 -2
- package/dist/index.cjs +123 -3
- package/dist/index.mjs +123 -3
- package/dist/node/index.cjs +123 -3
- package/dist/node/index.mjs +123 -3
- 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",
|
|
@@ -143,11 +143,22 @@ var require_abi = __commonJS({
|
|
|
143
143
|
"function stats() view returns (uint128 totalSubDAOsCreated, uint128 totalBurnedForCreation)",
|
|
144
144
|
// On-chain enumeration fallback (naming follows FactoryCoreFacet)
|
|
145
145
|
"function getSubDAOCount() view returns (uint256)",
|
|
146
|
-
"function subDaos(uint256) view returns (address)"
|
|
146
|
+
"function subDaos(uint256) view returns (address)",
|
|
147
|
+
// ISubDAOFactory interface functions
|
|
148
|
+
"function getAllSubDAOs() view returns (address[])",
|
|
149
|
+
"function getSubDAORegistry(address subdaoAddress) view returns (address)",
|
|
150
|
+
"function getRegistrySubDAO(address registryAddress) view returns (address)",
|
|
151
|
+
"function getFactoryStats() view returns (uint256 totalSubDAOs, uint256 totalBurned, uint256 averageBurnPerSubDAO)",
|
|
152
|
+
"function isSubDAO(address subdaoAddress) view returns (bool)"
|
|
147
153
|
];
|
|
148
154
|
var FactoryWrite = [
|
|
149
155
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
150
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)",
|
|
151
162
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
152
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)"
|
|
153
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",
|
|
@@ -143,11 +143,22 @@ var require_abi = __commonJS({
|
|
|
143
143
|
"function stats() view returns (uint128 totalSubDAOsCreated, uint128 totalBurnedForCreation)",
|
|
144
144
|
// On-chain enumeration fallback (naming follows FactoryCoreFacet)
|
|
145
145
|
"function getSubDAOCount() view returns (uint256)",
|
|
146
|
-
"function subDaos(uint256) view returns (address)"
|
|
146
|
+
"function subDaos(uint256) view returns (address)",
|
|
147
|
+
// ISubDAOFactory interface functions
|
|
148
|
+
"function getAllSubDAOs() view returns (address[])",
|
|
149
|
+
"function getSubDAORegistry(address subdaoAddress) view returns (address)",
|
|
150
|
+
"function getRegistrySubDAO(address registryAddress) view returns (address)",
|
|
151
|
+
"function getFactoryStats() view returns (uint256 totalSubDAOs, uint256 totalBurned, uint256 averageBurnPerSubDAO)",
|
|
152
|
+
"function isSubDAO(address subdaoAddress) view returns (bool)"
|
|
147
153
|
];
|
|
148
154
|
var FactoryWrite = [
|
|
149
155
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
150
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)",
|
|
151
162
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
152
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)"
|
|
153
164
|
];
|
|
@@ -3975,7 +3986,17 @@ var require_factory = __commonJS({
|
|
|
3975
3986
|
] = await Promise.all([
|
|
3976
3987
|
contract.stableFeeToken().catch(() => null),
|
|
3977
3988
|
contract.stableCreationFee().catch(() => null),
|
|
3978
|
-
|
|
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
|
+
})(),
|
|
3979
4000
|
contract.allowStableFee().catch(() => null),
|
|
3980
4001
|
contract.stablePromptForkFee().catch(() => null),
|
|
3981
4002
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4142,6 +4163,102 @@ var require_factory = __commonJS({
|
|
|
4142
4163
|
]);
|
|
4143
4164
|
return { to: addr, data: payload, value: 0n };
|
|
4144
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
|
+
}
|
|
4145
4262
|
async function listSubDAOs({ provider, factory: factory2 }) {
|
|
4146
4263
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4147
4264
|
const addr = normalise(factory2, "factory");
|
|
@@ -4222,6 +4339,9 @@ var require_factory = __commonJS({
|
|
|
4222
4339
|
getTemplateDetails,
|
|
4223
4340
|
buildCreateSubDAOTx,
|
|
4224
4341
|
buildCreateSubDAOWithStableTx,
|
|
4342
|
+
buildCreateSubDAOWithParamsTx,
|
|
4343
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4344
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4225
4345
|
buildCreateForkedSubDAOTx,
|
|
4226
4346
|
buildCreateForkedSubDAOWithStableTx
|
|
4227
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",
|
|
@@ -149,11 +149,22 @@ var require_abi = __commonJS({
|
|
|
149
149
|
"function stats() view returns (uint128 totalSubDAOsCreated, uint128 totalBurnedForCreation)",
|
|
150
150
|
// On-chain enumeration fallback (naming follows FactoryCoreFacet)
|
|
151
151
|
"function getSubDAOCount() view returns (uint256)",
|
|
152
|
-
"function subDaos(uint256) view returns (address)"
|
|
152
|
+
"function subDaos(uint256) view returns (address)",
|
|
153
|
+
// ISubDAOFactory interface functions
|
|
154
|
+
"function getAllSubDAOs() view returns (address[])",
|
|
155
|
+
"function getSubDAORegistry(address subdaoAddress) view returns (address)",
|
|
156
|
+
"function getRegistrySubDAO(address registryAddress) view returns (address)",
|
|
157
|
+
"function getFactoryStats() view returns (uint256 totalSubDAOs, uint256 totalBurned, uint256 averageBurnPerSubDAO)",
|
|
158
|
+
"function isSubDAO(address subdaoAddress) view returns (bool)"
|
|
153
159
|
];
|
|
154
160
|
var FactoryWrite = [
|
|
155
161
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
156
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)",
|
|
157
168
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
158
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)"
|
|
159
170
|
];
|
|
@@ -3981,7 +3992,17 @@ var require_factory = __commonJS({
|
|
|
3981
3992
|
] = await Promise.all([
|
|
3982
3993
|
contract.stableFeeToken().catch(() => null),
|
|
3983
3994
|
contract.stableCreationFee().catch(() => null),
|
|
3984
|
-
|
|
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
|
+
})(),
|
|
3985
4006
|
contract.allowStableFee().catch(() => null),
|
|
3986
4007
|
contract.stablePromptForkFee().catch(() => null),
|
|
3987
4008
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4148,6 +4169,102 @@ var require_factory = __commonJS({
|
|
|
4148
4169
|
]);
|
|
4149
4170
|
return { to: addr, data: payload, value: 0n };
|
|
4150
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
|
+
}
|
|
4151
4268
|
async function listSubDAOs({ provider, factory }) {
|
|
4152
4269
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4153
4270
|
const addr = normalise(factory, "factory");
|
|
@@ -4228,6 +4345,9 @@ var require_factory = __commonJS({
|
|
|
4228
4345
|
getTemplateDetails,
|
|
4229
4346
|
buildCreateSubDAOTx,
|
|
4230
4347
|
buildCreateSubDAOWithStableTx,
|
|
4348
|
+
buildCreateSubDAOWithParamsTx,
|
|
4349
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4350
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4231
4351
|
buildCreateForkedSubDAOTx,
|
|
4232
4352
|
buildCreateForkedSubDAOWithStableTx
|
|
4233
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",
|
|
@@ -143,11 +143,22 @@ var require_abi = __commonJS({
|
|
|
143
143
|
"function stats() view returns (uint128 totalSubDAOsCreated, uint128 totalBurnedForCreation)",
|
|
144
144
|
// On-chain enumeration fallback (naming follows FactoryCoreFacet)
|
|
145
145
|
"function getSubDAOCount() view returns (uint256)",
|
|
146
|
-
"function subDaos(uint256) view returns (address)"
|
|
146
|
+
"function subDaos(uint256) view returns (address)",
|
|
147
|
+
// ISubDAOFactory interface functions
|
|
148
|
+
"function getAllSubDAOs() view returns (address[])",
|
|
149
|
+
"function getSubDAORegistry(address subdaoAddress) view returns (address)",
|
|
150
|
+
"function getRegistrySubDAO(address registryAddress) view returns (address)",
|
|
151
|
+
"function getFactoryStats() view returns (uint256 totalSubDAOs, uint256 totalBurned, uint256 averageBurnPerSubDAO)",
|
|
152
|
+
"function isSubDAO(address subdaoAddress) view returns (bool)"
|
|
147
153
|
];
|
|
148
154
|
var FactoryWrite = [
|
|
149
155
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
150
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)",
|
|
151
162
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
152
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)"
|
|
153
164
|
];
|
|
@@ -3975,7 +3986,17 @@ var require_factory = __commonJS({
|
|
|
3975
3986
|
] = await Promise.all([
|
|
3976
3987
|
contract.stableFeeToken().catch(() => null),
|
|
3977
3988
|
contract.stableCreationFee().catch(() => null),
|
|
3978
|
-
|
|
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
|
+
})(),
|
|
3979
4000
|
contract.allowStableFee().catch(() => null),
|
|
3980
4001
|
contract.stablePromptForkFee().catch(() => null),
|
|
3981
4002
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4142,6 +4163,102 @@ var require_factory = __commonJS({
|
|
|
4142
4163
|
]);
|
|
4143
4164
|
return { to: addr, data: payload, value: 0n };
|
|
4144
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
|
+
}
|
|
4145
4262
|
async function listSubDAOs({ provider, factory }) {
|
|
4146
4263
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4147
4264
|
const addr = normalise(factory, "factory");
|
|
@@ -4222,6 +4339,9 @@ var require_factory = __commonJS({
|
|
|
4222
4339
|
getTemplateDetails,
|
|
4223
4340
|
buildCreateSubDAOTx,
|
|
4224
4341
|
buildCreateSubDAOWithStableTx,
|
|
4342
|
+
buildCreateSubDAOWithParamsTx,
|
|
4343
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4344
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4225
4345
|
buildCreateForkedSubDAOTx,
|
|
4226
4346
|
buildCreateForkedSubDAOWithStableTx
|
|
4227
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",
|
|
@@ -149,11 +149,22 @@ var require_abi = __commonJS({
|
|
|
149
149
|
"function stats() view returns (uint128 totalSubDAOsCreated, uint128 totalBurnedForCreation)",
|
|
150
150
|
// On-chain enumeration fallback (naming follows FactoryCoreFacet)
|
|
151
151
|
"function getSubDAOCount() view returns (uint256)",
|
|
152
|
-
"function subDaos(uint256) view returns (address)"
|
|
152
|
+
"function subDaos(uint256) view returns (address)",
|
|
153
|
+
// ISubDAOFactory interface functions
|
|
154
|
+
"function getAllSubDAOs() view returns (address[])",
|
|
155
|
+
"function getSubDAORegistry(address subdaoAddress) view returns (address)",
|
|
156
|
+
"function getRegistrySubDAO(address registryAddress) view returns (address)",
|
|
157
|
+
"function getFactoryStats() view returns (uint256 totalSubDAOs, uint256 totalBurned, uint256 averageBurnPerSubDAO)",
|
|
158
|
+
"function isSubDAO(address subdaoAddress) view returns (bool)"
|
|
153
159
|
];
|
|
154
160
|
var FactoryWrite = [
|
|
155
161
|
"function createSubDAO(string name, string description, uint8 accessModel, uint256 minStakeAmount, uint256 burnAmount) returns (address subDAO, address registry)",
|
|
156
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)",
|
|
157
168
|
"function createForkedSubDAO(string newName, string newDescription, string originalName, address originalSubDAO, address forker) returns (address subDAO, address registry)",
|
|
158
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)"
|
|
159
170
|
];
|
|
@@ -3981,7 +3992,17 @@ var require_factory = __commonJS({
|
|
|
3981
3992
|
] = await Promise.all([
|
|
3982
3993
|
contract.stableFeeToken().catch(() => null),
|
|
3983
3994
|
contract.stableCreationFee().catch(() => null),
|
|
3984
|
-
|
|
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
|
+
})(),
|
|
3985
4006
|
contract.allowStableFee().catch(() => null),
|
|
3986
4007
|
contract.stablePromptForkFee().catch(() => null),
|
|
3987
4008
|
contract.allowStablePromptForkFee().catch(() => null),
|
|
@@ -4148,6 +4169,102 @@ var require_factory = __commonJS({
|
|
|
4148
4169
|
]);
|
|
4149
4170
|
return { to: addr, data: payload, value: 0n };
|
|
4150
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
|
+
}
|
|
4151
4268
|
async function listSubDAOs({ provider, factory }) {
|
|
4152
4269
|
if (!provider) throw new SageSDKError(CODES.INVALID_ARGS, "provider required");
|
|
4153
4270
|
const addr = normalise(factory, "factory");
|
|
@@ -4228,6 +4345,9 @@ var require_factory = __commonJS({
|
|
|
4228
4345
|
getTemplateDetails,
|
|
4229
4346
|
buildCreateSubDAOTx,
|
|
4230
4347
|
buildCreateSubDAOWithStableTx,
|
|
4348
|
+
buildCreateSubDAOWithParamsTx,
|
|
4349
|
+
buildCreateOperatorSubDAOWithStableTx,
|
|
4350
|
+
buildCreateOperatorSubDAOWithStableAdvancedTx,
|
|
4231
4351
|
buildCreateForkedSubDAOTx,
|
|
4232
4352
|
buildCreateForkedSubDAOWithStableTx
|
|
4233
4353
|
};
|
package/package.json
CHANGED