@poa-box/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -0
- package/dist/abis/DirectDemocracyVotingNew.d.ts +749 -0
- package/dist/abis/DirectDemocracyVotingNew.js +961 -0
- package/dist/abis/ERC20.d.ts +90 -0
- package/dist/abis/ERC20.js +125 -0
- package/dist/abis/EducationHubNew.d.ts +590 -0
- package/dist/abis/EducationHubNew.js +762 -0
- package/dist/abis/EligibilityModuleNew.d.ts +1615 -0
- package/dist/abis/EligibilityModuleNew.js +2082 -0
- package/dist/abis/Executor.d.ts +619 -0
- package/dist/abis/Executor.js +796 -0
- package/dist/abis/HybridVotingNew.d.ts +898 -0
- package/dist/abis/HybridVotingNew.js +1149 -0
- package/dist/abis/ImplementationRegistry.d.ts +270 -0
- package/dist/abis/ImplementationRegistry.js +355 -0
- package/dist/abis/OrgDeployerNew.d.ts +1275 -0
- package/dist/abis/OrgDeployerNew.js +1630 -0
- package/dist/abis/OrgRegistry.d.ts +670 -0
- package/dist/abis/OrgRegistry.js +868 -0
- package/dist/abis/ParticipationToken.d.ts +1086 -0
- package/dist/abis/ParticipationToken.js +1415 -0
- package/dist/abis/PasskeyAccount.d.ts +788 -0
- package/dist/abis/PasskeyAccount.js +1019 -0
- package/dist/abis/PasskeyAccountFactory.d.ts +344 -0
- package/dist/abis/PasskeyAccountFactory.js +449 -0
- package/dist/abis/PaymasterHub.d.ts +1603 -0
- package/dist/abis/PaymasterHub.js +2048 -0
- package/dist/abis/PaymentManager.d.ts +520 -0
- package/dist/abis/PaymentManager.js +671 -0
- package/dist/abis/PoaManager.d.ts +344 -0
- package/dist/abis/PoaManager.js +449 -0
- package/dist/abis/QuickJoinNew.d.ts +855 -0
- package/dist/abis/QuickJoinNew.js +1098 -0
- package/dist/abis/TaskManagerNew.d.ts +1236 -0
- package/dist/abis/TaskManagerNew.js +1573 -0
- package/dist/abis/ToggleModule.d.ts +193 -0
- package/dist/abis/ToggleModule.js +255 -0
- package/dist/abis/UniversalAccountRegistry.d.ts +577 -0
- package/dist/abis/UniversalAccountRegistry.js +750 -0
- package/dist/abis/ZkEmailInvites.d.ts +823 -0
- package/dist/abis/ZkEmailInvites.js +1060 -0
- package/dist/abis/external/AaveGovernanceV2.d.ts +128 -0
- package/dist/abis/external/AaveGovernanceV2.js +177 -0
- package/dist/abis/external/AaveGovernanceV3.d.ts +160 -0
- package/dist/abis/external/AaveGovernanceV3.js +220 -0
- package/dist/abis/external/AragonVoting.d.ts +107 -0
- package/dist/abis/external/AragonVoting.js +150 -0
- package/dist/abis/external/CurveGaugeController.d.ts +95 -0
- package/dist/abis/external/CurveGaugeController.js +130 -0
- package/dist/abis/external/CurveVotingEscrow.d.ts +86 -0
- package/dist/abis/external/CurveVotingEscrow.js +116 -0
- package/dist/abis/external/GovernorAlpha.d.ts +172 -0
- package/dist/abis/external/GovernorAlpha.js +228 -0
- package/dist/abis/external/MakerDAOChief.d.ts +92 -0
- package/dist/abis/external/MakerDAOChief.js +129 -0
- package/dist/abis/external/OZGovernor.d.ts +227 -0
- package/dist/abis/external/OZGovernor.js +317 -0
- package/dist/abis/external/SolidlyVotingEscrow.d.ts +196 -0
- package/dist/abis/external/SolidlyVotingEscrow.js +260 -0
- package/dist/abis/index.d.ts +62 -0
- package/dist/abis/index.js +98 -0
- package/dist/chains.d.ts +150 -0
- package/dist/chains.js +320 -0
- package/dist/context.d.ts +48 -0
- package/dist/context.js +38 -0
- package/dist/contracts.d.ts +24 -0
- package/dist/contracts.js +41 -0
- package/dist/encoding.d.ts +58 -0
- package/dist/encoding.js +243 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.js +4 -0
- package/dist/error-catalog.d.ts +41 -0
- package/dist/error-catalog.js +941 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.js +60 -0
- package/dist/execute/ethers.d.ts +93 -0
- package/dist/execute/ethers.js +323 -0
- package/dist/execute/index.d.ts +7 -0
- package/dist/execute/index.js +23 -0
- package/dist/execute/sponsored.d.ts +68 -0
- package/dist/execute/sponsored.js +277 -0
- package/dist/exit-codes.d.ts +18 -0
- package/dist/exit-codes.js +21 -0
- package/dist/format.d.ts +21 -0
- package/dist/format.js +89 -0
- package/dist/graph/client.d.ts +298 -0
- package/dist/graph/client.js +702 -0
- package/dist/graph/documents/activity.d.ts +9 -0
- package/dist/graph/documents/activity.js +164 -0
- package/dist/graph/documents/beacons.d.ts +172 -0
- package/dist/graph/documents/beacons.js +345 -0
- package/dist/graph/documents/index.d.ts +21 -0
- package/dist/graph/documents/index.js +57 -0
- package/dist/graph/documents/infrastructure.d.ts +30 -0
- package/dist/graph/documents/infrastructure.js +34 -0
- package/dist/graph/documents/org.d.ts +15 -0
- package/dist/graph/documents/org.js +249 -0
- package/dist/graph/documents/paymaster.d.ts +95 -0
- package/dist/graph/documents/paymaster.js +101 -0
- package/dist/graph/documents/role.d.ts +6 -0
- package/dist/graph/documents/role.js +41 -0
- package/dist/graph/documents/roles.d.ts +50 -0
- package/dist/graph/documents/roles.js +112 -0
- package/dist/graph/documents/task.d.ts +84 -0
- package/dist/graph/documents/task.js +236 -0
- package/dist/graph/documents/token.d.ts +13 -0
- package/dist/graph/documents/token.js +126 -0
- package/dist/graph/documents/treasury.d.ts +39 -0
- package/dist/graph/documents/treasury.js +136 -0
- package/dist/graph/documents/user.d.ts +120 -0
- package/dist/graph/documents/user.js +302 -0
- package/dist/graph/documents/voting-classes.d.ts +69 -0
- package/dist/graph/documents/voting-classes.js +149 -0
- package/dist/graph/documents/voting.d.ts +28 -0
- package/dist/graph/documents/voting.js +163 -0
- package/dist/graph/documents/vouch.d.ts +79 -0
- package/dist/graph/documents/vouch.js +171 -0
- package/dist/graph/documents/zkemail.d.ts +63 -0
- package/dist/graph/documents/zkemail.js +188 -0
- package/dist/graph/index.d.ts +2 -0
- package/dist/graph/index.js +41 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +92 -0
- package/dist/ipfs.d.ts +39 -0
- package/dist/ipfs.js +214 -0
- package/dist/label-aliases.d.ts +31 -0
- package/dist/label-aliases.js +70 -0
- package/dist/metadata/education.d.ts +30 -0
- package/dist/metadata/education.js +31 -0
- package/dist/metadata/index.d.ts +12 -0
- package/dist/metadata/index.js +48 -0
- package/dist/metadata/org.d.ts +92 -0
- package/dist/metadata/org.js +93 -0
- package/dist/metadata/proposal.d.ts +44 -0
- package/dist/metadata/proposal.js +45 -0
- package/dist/metadata/role.d.ts +38 -0
- package/dist/metadata/role.js +35 -0
- package/dist/metadata/task.d.ts +108 -0
- package/dist/metadata/task.js +81 -0
- package/dist/metadata/token.d.ts +32 -0
- package/dist/metadata/token.js +36 -0
- package/dist/metadata/user.d.ts +63 -0
- package/dist/metadata/user.js +70 -0
- package/dist/multicall.d.ts +32 -0
- package/dist/multicall.js +96 -0
- package/dist/payout.d.ts +59 -0
- package/dist/payout.js +96 -0
- package/dist/perms.d.ts +47 -0
- package/dist/perms.js +120 -0
- package/dist/preflight.d.ts +72 -0
- package/dist/preflight.js +269 -0
- package/dist/reads/education.d.ts +79 -0
- package/dist/reads/education.js +122 -0
- package/dist/reads/eligibility.d.ts +377 -0
- package/dist/reads/eligibility.js +687 -0
- package/dist/reads/index.d.ts +16 -0
- package/dist/reads/index.js +55 -0
- package/dist/reads/org.d.ts +258 -0
- package/dist/reads/org.js +220 -0
- package/dist/reads/paymaster.d.ts +147 -0
- package/dist/reads/paymaster.js +235 -0
- package/dist/reads/project.d.ts +33 -0
- package/dist/reads/project.js +62 -0
- package/dist/reads/resolve.d.ts +34 -0
- package/dist/reads/resolve.js +64 -0
- package/dist/reads/task.d.ts +286 -0
- package/dist/reads/task.js +280 -0
- package/dist/reads/token.d.ts +94 -0
- package/dist/reads/token.js +75 -0
- package/dist/reads/treasury.d.ts +222 -0
- package/dist/reads/treasury.js +241 -0
- package/dist/reads/user.d.ts +229 -0
- package/dist/reads/user.js +155 -0
- package/dist/reads/vote.d.ts +296 -0
- package/dist/reads/vote.js +392 -0
- package/dist/reads/zkemail.d.ts +117 -0
- package/dist/reads/zkemail.js +217 -0
- package/dist/similarity.d.ts +36 -0
- package/dist/similarity.js +67 -0
- package/dist/sponsorship-config.d.ts +47 -0
- package/dist/sponsorship-config.js +41 -0
- package/dist/stats.d.ts +11 -0
- package/dist/stats.js +27 -0
- package/dist/task-lens.d.ts +113 -0
- package/dist/task-lens.js +210 -0
- package/dist/tx/education.d.ts +169 -0
- package/dist/tx/education.js +344 -0
- package/dist/tx/eligibility.d.ts +511 -0
- package/dist/tx/eligibility.js +818 -0
- package/dist/tx/governance.d.ts +85 -0
- package/dist/tx/governance.js +87 -0
- package/dist/tx/index.d.ts +17 -0
- package/dist/tx/index.js +56 -0
- package/dist/tx/intent.d.ts +67 -0
- package/dist/tx/intent.js +48 -0
- package/dist/tx/org.d.ts +321 -0
- package/dist/tx/org.js +544 -0
- package/dist/tx/paymaster.d.ts +140 -0
- package/dist/tx/paymaster.js +251 -0
- package/dist/tx/project.d.ts +146 -0
- package/dist/tx/project.js +217 -0
- package/dist/tx/task.d.ts +480 -0
- package/dist/tx/task.js +1149 -0
- package/dist/tx/token.d.ts +96 -0
- package/dist/tx/token.js +165 -0
- package/dist/tx/treasury.d.ts +474 -0
- package/dist/tx/treasury.js +911 -0
- package/dist/tx/user.d.ts +177 -0
- package/dist/tx/user.js +292 -0
- package/dist/tx/vote.d.ts +332 -0
- package/dist/tx/vote.js +762 -0
- package/dist/tx/zkemail.d.ts +90 -0
- package/dist/tx/zkemail.js +210 -0
- package/dist/validation.d.ts +8 -0
- package/dist/validation.js +39 -0
- package/dist/version.d.ts +142 -0
- package/dist/version.js +257 -0
- package/dist/zkemail.d.ts +161 -0
- package/dist/zkemail.js +299 -0
- package/package.json +130 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance wraps — the shared createProposal builder.
|
|
3
|
+
*
|
|
4
|
+
* Every governance-side change in POP (~10 CLI commands) broadcasts the SAME
|
|
5
|
+
* method: `createProposal(titleBytes, descriptionHash, durationMinutes,
|
|
6
|
+
* numOptions, batches, hatIds)` on a HybridVoting or DirectDemocracyVoting
|
|
7
|
+
* module, where option 0's batch carries `[target, value, calldata][]` triples
|
|
8
|
+
* that the Executor runs if option 0 wins.
|
|
9
|
+
*
|
|
10
|
+
* Encoding parity notes (verified against src/commands/vote/create.ts and
|
|
11
|
+
* src/commands/vote/propose-quorum.ts):
|
|
12
|
+
* - title is encoded with stringToBytes (UTF-8 Uint8Array), NOT bytes32
|
|
13
|
+
* - each batch entry is the positional tuple [target, BigNumber(value), data]
|
|
14
|
+
* - a proposal with NO execution calls passes `batches: []` — the empty
|
|
15
|
+
* outer array, not [[], []] (vote create only builds per-option batches
|
|
16
|
+
* when --calls is given). Wrap commands always pass [option0Calls, []].
|
|
17
|
+
* - hatIds default to [] and must be BigNumbers/strings — real Hats IDs
|
|
18
|
+
* exceed 2^53 and are mangled by Number
|
|
19
|
+
*
|
|
20
|
+
* First consumers: vote create / propose-quorum / propose-config / classes
|
|
21
|
+
* propose (tx/vote.ts), task perms propose-global, org set-metadata-admin,
|
|
22
|
+
* project propose. Other agents import these from './governance'.
|
|
23
|
+
*/
|
|
24
|
+
import { ethers } from 'ethers';
|
|
25
|
+
import type { TxIntent } from './intent';
|
|
26
|
+
/** One execution call in an option batch: encoded as [target, value, calldata]. */
|
|
27
|
+
export interface ExecutionCall {
|
|
28
|
+
target: string;
|
|
29
|
+
value: ethers.BigNumberish;
|
|
30
|
+
calldata: string;
|
|
31
|
+
}
|
|
32
|
+
export interface GovernanceWrapParams {
|
|
33
|
+
/** Hybrid or DD voting module address (the proposal is created on it). */
|
|
34
|
+
votingAddress: string;
|
|
35
|
+
votingAbiName: 'HybridVotingNew' | 'DirectDemocracyVotingNew';
|
|
36
|
+
/** Proposal title — encoded with stringToBytes. */
|
|
37
|
+
title: string;
|
|
38
|
+
/** bytes32 — ipfsCidToBytes32 of the pinned proposal metadata. */
|
|
39
|
+
descriptionHash: string;
|
|
40
|
+
durationMinutes: ethers.BigNumberish;
|
|
41
|
+
/** 2 for yes/no wraps. */
|
|
42
|
+
numOptions: number;
|
|
43
|
+
/**
|
|
44
|
+
* Option-indexed execution batches. CLI wraps use [option0Calls, []];
|
|
45
|
+
* a call-free proposal uses [] (see module doc — the empty-array quirk).
|
|
46
|
+
*/
|
|
47
|
+
batches: ExecutionCall[][];
|
|
48
|
+
/** Restricted-voting hats; [] default. */
|
|
49
|
+
hatIds?: ethers.BigNumberish[];
|
|
50
|
+
orgId?: string;
|
|
51
|
+
/** meta.action override (default 'create'). */
|
|
52
|
+
action?: string;
|
|
53
|
+
/** meta.domain override for non-vote consumers (default 'vote'). */
|
|
54
|
+
domain?: string;
|
|
55
|
+
summary?: Record<string, unknown>;
|
|
56
|
+
/** meta.ipfs passthrough for builders that pinned the metadata themselves. */
|
|
57
|
+
ipfs?: {
|
|
58
|
+
cid: string;
|
|
59
|
+
metadata: unknown;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Level-1 pure builder for `createProposal` — port of the tx built by
|
|
64
|
+
* `pop vote create` (src/commands/vote/create.ts) and shared verbatim by
|
|
65
|
+
* every governance-wrap command (propose-quorum, propose-config, classes
|
|
66
|
+
* propose, perms propose-global, set-metadata-admin, project propose).
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildGovernanceProposal(p: GovernanceWrapParams): TxIntent;
|
|
69
|
+
/**
|
|
70
|
+
* Encode one execution call for an option batch: calldata via the named ABI's
|
|
71
|
+
* Interface (both voting ABIs and TaskManagerNew carry exactly one fragment
|
|
72
|
+
* per method name, so this matches the CLI's inline-fragment encoding
|
|
73
|
+
* byte-for-byte).
|
|
74
|
+
*/
|
|
75
|
+
export declare function encodeExecutorCall(abiName: string, target: string, method: string, args: unknown[], value?: ethers.BigNumberish): ExecutionCall;
|
|
76
|
+
/**
|
|
77
|
+
* Extract the created proposal ID from parsed receipt logs — the CLI's
|
|
78
|
+
* `result.logs?.find(l => l.name === 'NewProposal' || l.name === 'NewHatProposal')`
|
|
79
|
+
* shared by every createProposal site. Accepts any parsed-log shape
|
|
80
|
+
* (ethers LogDescription[] / TxResult.logs).
|
|
81
|
+
*/
|
|
82
|
+
export declare function parseProposalCreatedLogs(logs: Array<{
|
|
83
|
+
name: string;
|
|
84
|
+
args?: any;
|
|
85
|
+
}> | undefined | null): string | undefined;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Governance wraps — the shared createProposal builder.
|
|
4
|
+
*
|
|
5
|
+
* Every governance-side change in POP (~10 CLI commands) broadcasts the SAME
|
|
6
|
+
* method: `createProposal(titleBytes, descriptionHash, durationMinutes,
|
|
7
|
+
* numOptions, batches, hatIds)` on a HybridVoting or DirectDemocracyVoting
|
|
8
|
+
* module, where option 0's batch carries `[target, value, calldata][]` triples
|
|
9
|
+
* that the Executor runs if option 0 wins.
|
|
10
|
+
*
|
|
11
|
+
* Encoding parity notes (verified against src/commands/vote/create.ts and
|
|
12
|
+
* src/commands/vote/propose-quorum.ts):
|
|
13
|
+
* - title is encoded with stringToBytes (UTF-8 Uint8Array), NOT bytes32
|
|
14
|
+
* - each batch entry is the positional tuple [target, BigNumber(value), data]
|
|
15
|
+
* - a proposal with NO execution calls passes `batches: []` — the empty
|
|
16
|
+
* outer array, not [[], []] (vote create only builds per-option batches
|
|
17
|
+
* when --calls is given). Wrap commands always pass [option0Calls, []].
|
|
18
|
+
* - hatIds default to [] and must be BigNumbers/strings — real Hats IDs
|
|
19
|
+
* exceed 2^53 and are mangled by Number
|
|
20
|
+
*
|
|
21
|
+
* First consumers: vote create / propose-quorum / propose-config / classes
|
|
22
|
+
* propose (tx/vote.ts), task perms propose-global, org set-metadata-admin,
|
|
23
|
+
* project propose. Other agents import these from './governance'.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.buildGovernanceProposal = buildGovernanceProposal;
|
|
27
|
+
exports.encodeExecutorCall = encodeExecutorCall;
|
|
28
|
+
exports.parseProposalCreatedLogs = parseProposalCreatedLogs;
|
|
29
|
+
const ethers_1 = require("ethers");
|
|
30
|
+
const contracts_1 = require("../contracts");
|
|
31
|
+
const encoding_1 = require("../encoding");
|
|
32
|
+
/**
|
|
33
|
+
* Level-1 pure builder for `createProposal` — port of the tx built by
|
|
34
|
+
* `pop vote create` (src/commands/vote/create.ts) and shared verbatim by
|
|
35
|
+
* every governance-wrap command (propose-quorum, propose-config, classes
|
|
36
|
+
* propose, perms propose-global, set-metadata-admin, project propose).
|
|
37
|
+
*/
|
|
38
|
+
function buildGovernanceProposal(p) {
|
|
39
|
+
// [target, BigNumber(value), data] — same tuple construction as the CLI
|
|
40
|
+
// (`c.value || '0'` handles undefined/empty values as zero).
|
|
41
|
+
const batchTuples = p.batches.map(batch => batch.map(call => [call.target, ethers_1.ethers.BigNumber.from(call.value || 0), call.calldata]));
|
|
42
|
+
const hatIds = p.hatIds ?? [];
|
|
43
|
+
return {
|
|
44
|
+
to: p.votingAddress,
|
|
45
|
+
abi: (0, contracts_1.getAbi)(p.votingAbiName),
|
|
46
|
+
method: 'createProposal',
|
|
47
|
+
args: [
|
|
48
|
+
(0, encoding_1.stringToBytes)(p.title),
|
|
49
|
+
p.descriptionHash,
|
|
50
|
+
p.durationMinutes,
|
|
51
|
+
p.numOptions,
|
|
52
|
+
batchTuples,
|
|
53
|
+
hatIds,
|
|
54
|
+
],
|
|
55
|
+
meta: {
|
|
56
|
+
domain: p.domain ?? 'vote',
|
|
57
|
+
action: p.action ?? 'create',
|
|
58
|
+
orgId: p.orgId,
|
|
59
|
+
summary: p.summary,
|
|
60
|
+
...(p.ipfs ? { ipfs: p.ipfs } : {}),
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Encode one execution call for an option batch: calldata via the named ABI's
|
|
66
|
+
* Interface (both voting ABIs and TaskManagerNew carry exactly one fragment
|
|
67
|
+
* per method name, so this matches the CLI's inline-fragment encoding
|
|
68
|
+
* byte-for-byte).
|
|
69
|
+
*/
|
|
70
|
+
function encodeExecutorCall(abiName, target, method, args, value) {
|
|
71
|
+
const iface = new ethers_1.ethers.utils.Interface((0, contracts_1.getAbi)(abiName));
|
|
72
|
+
return {
|
|
73
|
+
target,
|
|
74
|
+
value: value ?? 0,
|
|
75
|
+
calldata: iface.encodeFunctionData(method, args),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Extract the created proposal ID from parsed receipt logs — the CLI's
|
|
80
|
+
* `result.logs?.find(l => l.name === 'NewProposal' || l.name === 'NewHatProposal')`
|
|
81
|
+
* shared by every createProposal site. Accepts any parsed-log shape
|
|
82
|
+
* (ethers LogDescription[] / TxResult.logs).
|
|
83
|
+
*/
|
|
84
|
+
function parseProposalCreatedLogs(logs) {
|
|
85
|
+
const proposalEvent = (logs ?? []).find(l => l.name === 'NewProposal' || l.name === 'NewHatProposal');
|
|
86
|
+
return proposalEvent?.args?.id?.toString();
|
|
87
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intent builders by domain. tx/intent.ts (TxIntent, encodeIntent) is
|
|
3
|
+
* re-exported flat; each domain is a namespace.
|
|
4
|
+
*/
|
|
5
|
+
export * from './intent';
|
|
6
|
+
export * as education from './education';
|
|
7
|
+
export * as eligibility from './eligibility';
|
|
8
|
+
export * as governance from './governance';
|
|
9
|
+
export * as org from './org';
|
|
10
|
+
export * as paymaster from './paymaster';
|
|
11
|
+
export * as project from './project';
|
|
12
|
+
export * as task from './task';
|
|
13
|
+
export * as token from './token';
|
|
14
|
+
export * as treasury from './treasury';
|
|
15
|
+
export * as user from './user';
|
|
16
|
+
export * as vote from './vote';
|
|
17
|
+
export * as zkemail from './zkemail';
|
package/dist/tx/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Intent builders by domain. tx/intent.ts (TxIntent, encodeIntent) is
|
|
4
|
+
* re-exported flat; each domain is a namespace.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
23
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
24
|
+
};
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.zkemail = exports.vote = exports.user = exports.treasury = exports.token = exports.task = exports.project = exports.paymaster = exports.org = exports.governance = exports.eligibility = exports.education = void 0;
|
|
44
|
+
__exportStar(require("./intent"), exports);
|
|
45
|
+
exports.education = __importStar(require("./education"));
|
|
46
|
+
exports.eligibility = __importStar(require("./eligibility"));
|
|
47
|
+
exports.governance = __importStar(require("./governance"));
|
|
48
|
+
exports.org = __importStar(require("./org"));
|
|
49
|
+
exports.paymaster = __importStar(require("./paymaster"));
|
|
50
|
+
exports.project = __importStar(require("./project"));
|
|
51
|
+
exports.task = __importStar(require("./task"));
|
|
52
|
+
exports.token = __importStar(require("./token"));
|
|
53
|
+
exports.treasury = __importStar(require("./treasury"));
|
|
54
|
+
exports.user = __importStar(require("./user"));
|
|
55
|
+
exports.vote = __importStar(require("./vote"));
|
|
56
|
+
exports.zkemail = __importStar(require("./zkemail"));
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction intents — the wallet-agnostic write primitive.
|
|
3
|
+
*
|
|
4
|
+
* Every POP write is representable as (to, abi, method, args, value): the CLI
|
|
5
|
+
* has always funneled that tuple into executeTx, and the frontend funnels the
|
|
6
|
+
* same tuple into its three interchangeable transaction managers (direct EOA,
|
|
7
|
+
* ERC-4337 passkey, EIP-7702 sponsored). A TxIntent reifies the tuple as data
|
|
8
|
+
* so ANY of those stacks — plus wagmi/viem, Safe batches, raw JSON-RPC — can
|
|
9
|
+
* execute it:
|
|
10
|
+
*
|
|
11
|
+
* CLI / agent: executeIntent(signer, intent) (execute/ethers)
|
|
12
|
+
* wagmi/viem: writeContract({ address: intent.to, abi: intent.abi,
|
|
13
|
+
* functionName: intent.method, args: intent.args })
|
|
14
|
+
* 4337 / 7702: sendSponsored(key, intent.to, encodeIntent(intent).data, ...)
|
|
15
|
+
* anything else: encodeIntent(intent) → { to, data, value }
|
|
16
|
+
*
|
|
17
|
+
* Domain builders (tx/<domain>.ts) return intents; they never sign or send.
|
|
18
|
+
*/
|
|
19
|
+
import { ethers } from 'ethers';
|
|
20
|
+
export interface TxIntentMeta {
|
|
21
|
+
/** Command-style domain, e.g. 'task' | 'vote' | 'org' | 'treasury'. */
|
|
22
|
+
domain: string;
|
|
23
|
+
/** Action within the domain, e.g. 'create' | 'cast' | 'claim'. */
|
|
24
|
+
action: string;
|
|
25
|
+
/** Org the intent targets, when org-scoped. */
|
|
26
|
+
orgId?: string;
|
|
27
|
+
/** Human-readable preview fields for confirmation UIs. */
|
|
28
|
+
summary?: Record<string, unknown>;
|
|
29
|
+
/** Metadata pinned to IPFS while building the intent, if any. */
|
|
30
|
+
ipfs?: {
|
|
31
|
+
cid: string;
|
|
32
|
+
metadata: unknown;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface TxIntent {
|
|
36
|
+
/** Resolved contract address. */
|
|
37
|
+
to: string;
|
|
38
|
+
/** Full fragment set — used for encoding AND receipt-log parsing. */
|
|
39
|
+
abi: any[];
|
|
40
|
+
/** Contract method name, e.g. 'createTask'. */
|
|
41
|
+
method: string;
|
|
42
|
+
/** Fully encoded, contract-ordered arguments. */
|
|
43
|
+
args: unknown[];
|
|
44
|
+
/** Native value, when the method is payable. */
|
|
45
|
+
value?: ethers.BigNumberish;
|
|
46
|
+
meta: TxIntentMeta;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pure calldata encoding — no provider, no signer, no network.
|
|
50
|
+
* `value` is returned as a decimal string ('0' when absent) so the result is
|
|
51
|
+
* JSON-serializable and stack-agnostic.
|
|
52
|
+
*/
|
|
53
|
+
export declare function encodeIntent(intent: TxIntent): {
|
|
54
|
+
to: string;
|
|
55
|
+
data: string;
|
|
56
|
+
value: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Materialize an intent as an ethers v5 Contract call triple, for hosts that
|
|
60
|
+
* already speak (contract, method, args) — the CLI's executeTx and the
|
|
61
|
+
* frontend's txManager.execute both do.
|
|
62
|
+
*/
|
|
63
|
+
export declare function intentToContractCall(intent: TxIntent, signerOrProvider: ethers.Signer | ethers.providers.Provider): {
|
|
64
|
+
contract: ethers.Contract;
|
|
65
|
+
method: string;
|
|
66
|
+
args: unknown[];
|
|
67
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Transaction intents — the wallet-agnostic write primitive.
|
|
4
|
+
*
|
|
5
|
+
* Every POP write is representable as (to, abi, method, args, value): the CLI
|
|
6
|
+
* has always funneled that tuple into executeTx, and the frontend funnels the
|
|
7
|
+
* same tuple into its three interchangeable transaction managers (direct EOA,
|
|
8
|
+
* ERC-4337 passkey, EIP-7702 sponsored). A TxIntent reifies the tuple as data
|
|
9
|
+
* so ANY of those stacks — plus wagmi/viem, Safe batches, raw JSON-RPC — can
|
|
10
|
+
* execute it:
|
|
11
|
+
*
|
|
12
|
+
* CLI / agent: executeIntent(signer, intent) (execute/ethers)
|
|
13
|
+
* wagmi/viem: writeContract({ address: intent.to, abi: intent.abi,
|
|
14
|
+
* functionName: intent.method, args: intent.args })
|
|
15
|
+
* 4337 / 7702: sendSponsored(key, intent.to, encodeIntent(intent).data, ...)
|
|
16
|
+
* anything else: encodeIntent(intent) → { to, data, value }
|
|
17
|
+
*
|
|
18
|
+
* Domain builders (tx/<domain>.ts) return intents; they never sign or send.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.encodeIntent = encodeIntent;
|
|
22
|
+
exports.intentToContractCall = intentToContractCall;
|
|
23
|
+
const ethers_1 = require("ethers");
|
|
24
|
+
/**
|
|
25
|
+
* Pure calldata encoding — no provider, no signer, no network.
|
|
26
|
+
* `value` is returned as a decimal string ('0' when absent) so the result is
|
|
27
|
+
* JSON-serializable and stack-agnostic.
|
|
28
|
+
*/
|
|
29
|
+
function encodeIntent(intent) {
|
|
30
|
+
const iface = new ethers_1.ethers.utils.Interface(intent.abi);
|
|
31
|
+
return {
|
|
32
|
+
to: intent.to,
|
|
33
|
+
data: iface.encodeFunctionData(intent.method, intent.args),
|
|
34
|
+
value: ethers_1.ethers.BigNumber.from(intent.value ?? 0).toString(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Materialize an intent as an ethers v5 Contract call triple, for hosts that
|
|
39
|
+
* already speak (contract, method, args) — the CLI's executeTx and the
|
|
40
|
+
* frontend's txManager.execute both do.
|
|
41
|
+
*/
|
|
42
|
+
function intentToContractCall(intent, signerOrProvider) {
|
|
43
|
+
return {
|
|
44
|
+
contract: new ethers_1.ethers.Contract(intent.to, intent.abi, signerOrProvider),
|
|
45
|
+
method: intent.method,
|
|
46
|
+
args: intent.args,
|
|
47
|
+
};
|
|
48
|
+
}
|
package/dist/tx/org.d.ts
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Org write builders.
|
|
3
|
+
*
|
|
4
|
+
* Ports:
|
|
5
|
+
* - `pop org deploy` — src/commands/org/deploy.ts
|
|
6
|
+
* - `pop org update-metadata` — src/commands/org/update-metadata.ts
|
|
7
|
+
* - `pop org set-metadata-admin` — src/commands/org/set-metadata-admin.ts
|
|
8
|
+
*
|
|
9
|
+
* Level-1 builders are pure (sync, zero I/O) and own ALL argument encoding.
|
|
10
|
+
* Level-2 `<action>Intent(ctx, params)` builders resolve addresses via the
|
|
11
|
+
* subgraph, pin metadata to IPFS, and delegate to Level 1.
|
|
12
|
+
*/
|
|
13
|
+
import { ethers } from 'ethers';
|
|
14
|
+
import type { TxIntent } from './intent';
|
|
15
|
+
import type { PopContext } from '../context';
|
|
16
|
+
import type { OrgLink, OrgMetadataUpdates } from '../metadata/org';
|
|
17
|
+
/**
|
|
18
|
+
* Org deploy config schema (port of the config-file schema in
|
|
19
|
+
* src/commands/org/deploy.ts). Matches the DeploymentParams struct expected
|
|
20
|
+
* by OrgDeployer.deployFullOrg().
|
|
21
|
+
*/
|
|
22
|
+
export interface OrgDeployConfig {
|
|
23
|
+
orgName: string;
|
|
24
|
+
deployerUsername?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
links?: OrgLink[];
|
|
27
|
+
autoUpgrade?: boolean;
|
|
28
|
+
hybridVoting: {
|
|
29
|
+
thresholdPct: number;
|
|
30
|
+
classes: Array<{
|
|
31
|
+
strategy: 'DIRECT' | 'ERC20_BAL';
|
|
32
|
+
slicePct: number;
|
|
33
|
+
quadratic?: boolean;
|
|
34
|
+
minBalance?: string;
|
|
35
|
+
asset?: string;
|
|
36
|
+
hatIds?: number[];
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
directDemocracy: {
|
|
40
|
+
thresholdPct: number;
|
|
41
|
+
};
|
|
42
|
+
roles: Array<{
|
|
43
|
+
name: string;
|
|
44
|
+
image?: string;
|
|
45
|
+
canVote: boolean;
|
|
46
|
+
vouching?: {
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
quorum: number;
|
|
49
|
+
voucherRoleIndex: number;
|
|
50
|
+
combineWithHierarchy?: boolean;
|
|
51
|
+
};
|
|
52
|
+
defaults?: {
|
|
53
|
+
eligible: boolean;
|
|
54
|
+
standing: boolean;
|
|
55
|
+
};
|
|
56
|
+
hierarchy?: {
|
|
57
|
+
adminRoleIndex: number;
|
|
58
|
+
};
|
|
59
|
+
distribution?: {
|
|
60
|
+
mintToDeployer: boolean;
|
|
61
|
+
additionalWearers?: string[];
|
|
62
|
+
};
|
|
63
|
+
hatConfig?: {
|
|
64
|
+
maxSupply: number;
|
|
65
|
+
mutableHat: boolean;
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
roleAssignments: {
|
|
69
|
+
quickJoinRoles: number[];
|
|
70
|
+
tokenMemberRoles: number[];
|
|
71
|
+
tokenApproverRoles: number[];
|
|
72
|
+
taskCreatorRoles: number[];
|
|
73
|
+
educationCreatorRoles?: number[];
|
|
74
|
+
educationMemberRoles?: number[];
|
|
75
|
+
hybridProposalCreatorRoles: number[];
|
|
76
|
+
ddVotingRoles: number[];
|
|
77
|
+
ddCreatorRoles: number[];
|
|
78
|
+
};
|
|
79
|
+
metadataAdminRoleIndex?: number;
|
|
80
|
+
educationHub?: {
|
|
81
|
+
enabled: boolean;
|
|
82
|
+
};
|
|
83
|
+
paymaster?: {
|
|
84
|
+
operatorRoleIndex: number;
|
|
85
|
+
maxFeePerGas: string;
|
|
86
|
+
maxPriorityFeePerGas: string;
|
|
87
|
+
defaultBudgetCapPerEpoch: string;
|
|
88
|
+
defaultBudgetEpochLen: number;
|
|
89
|
+
funding?: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Optional org-wide TaskManager ROLE_PERM grants applied at deploy time
|
|
93
|
+
* (OrgDeployer.TaskManagerPermConfig — roleIndices resolve to hat IDs,
|
|
94
|
+
* masks are TaskPerm bitmasks: 1=create 2=claim 4=review 8=assign …).
|
|
95
|
+
*/
|
|
96
|
+
taskManagerPerms?: {
|
|
97
|
+
roleIndices: number[];
|
|
98
|
+
masks: number[];
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Port of indicesToBitmap in src/commands/org/deploy.ts. */
|
|
102
|
+
export declare function indicesToBitmap(indices: number[]): ethers.BigNumber;
|
|
103
|
+
/**
|
|
104
|
+
* Reject role indices that do not name a role in the config.
|
|
105
|
+
*
|
|
106
|
+
* RoleResolver reverts UnregisteredRole(roleIdx) when a bitmap bit has no registered hat
|
|
107
|
+
* (audit M-09) — previously hat 0 was silently stored as an "authorized" hat and the deploy
|
|
108
|
+
* succeeded with a broken allowlist. Either way the config is wrong, and we know roles.length
|
|
109
|
+
* here, so name the offending field instead of surfacing a bare index from gas estimation
|
|
110
|
+
* (older deployers) or an aborted deploy (upgraded ones).
|
|
111
|
+
*/
|
|
112
|
+
export declare function assertRoleIndices(field: string, indices: number[] | undefined, roleCount: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Derive the deterministic orgId + normalized name the deployer uses:
|
|
115
|
+
* orgId = keccak256(orgName.toLowerCase().replace(/\s+/g, '-')).
|
|
116
|
+
* The normalized name is also the default deployer username.
|
|
117
|
+
*/
|
|
118
|
+
export declare function deriveOrgId(orgName: string): {
|
|
119
|
+
orgId: string;
|
|
120
|
+
normalizedName: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Minimal structural type for an ethers v5 signer that can sign EIP-712
|
|
124
|
+
* typed data (Wallet and JsonRpcSigner both satisfy it).
|
|
125
|
+
*/
|
|
126
|
+
export interface RegisterAccountSigner {
|
|
127
|
+
_signTypedData(domain: Record<string, unknown>, types: Record<string, Array<{
|
|
128
|
+
name: string;
|
|
129
|
+
type: string;
|
|
130
|
+
}>>, value: Record<string, unknown>): Promise<string>;
|
|
131
|
+
}
|
|
132
|
+
/** EIP-712 type set for UniversalAccountRegistry registration. */
|
|
133
|
+
export declare const REGISTER_ACCOUNT_TYPES: {
|
|
134
|
+
readonly RegisterAccount: readonly [{
|
|
135
|
+
readonly name: "user";
|
|
136
|
+
readonly type: "address";
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "username";
|
|
139
|
+
readonly type: "string";
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "nonce";
|
|
142
|
+
readonly type: "uint256";
|
|
143
|
+
}, {
|
|
144
|
+
readonly name: "deadline";
|
|
145
|
+
readonly type: "uint256";
|
|
146
|
+
}];
|
|
147
|
+
};
|
|
148
|
+
/** EIP-712 domain for UniversalAccountRegistry registration. */
|
|
149
|
+
export declare function registerAccountDomain(chainId: number, registryAddress: string): {
|
|
150
|
+
name: string;
|
|
151
|
+
version: string;
|
|
152
|
+
chainId: number;
|
|
153
|
+
verifyingContract: string;
|
|
154
|
+
};
|
|
155
|
+
export interface RegisterAccountMessage {
|
|
156
|
+
registryAddress: string;
|
|
157
|
+
chainId: number;
|
|
158
|
+
user: string;
|
|
159
|
+
username: string;
|
|
160
|
+
nonce: ethers.BigNumberish;
|
|
161
|
+
deadline: number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Port of the EIP-712 RegisterAccount signature step in `pop org deploy`
|
|
165
|
+
* (src/commands/org/deploy.ts): registration happens INSIDE deployFullOrg via
|
|
166
|
+
* this signature — it is not a separate tx. Kept as a separate function taking
|
|
167
|
+
* a Signer so hosts control key custody; everything else here is pure data.
|
|
168
|
+
*/
|
|
169
|
+
export declare function signRegisterAccount(signer: RegisterAccountSigner, params: RegisterAccountMessage): Promise<string>;
|
|
170
|
+
/** Resolved inputs the pure param assembly needs beyond the config file. */
|
|
171
|
+
export interface DeploymentResolvedInputs {
|
|
172
|
+
/** keccak256 of the lowercased-dashed org name (see deriveOrgId). */
|
|
173
|
+
orgId: string;
|
|
174
|
+
/** bytes32 of the pinned org metadata CID. */
|
|
175
|
+
metadataHash: string;
|
|
176
|
+
/** UniversalAccountRegistry proxy (globalAccountRegistryProxy). */
|
|
177
|
+
registryAddr: string;
|
|
178
|
+
deployerAddress: string;
|
|
179
|
+
deployerUsername: string;
|
|
180
|
+
/** unix seconds; the CLI uses now + 900 (nonce-bound, so not replayable). */
|
|
181
|
+
regDeadline: number;
|
|
182
|
+
/** UniversalAccountRegistry.nonces(deployerAddress). */
|
|
183
|
+
regNonce: ethers.BigNumberish;
|
|
184
|
+
/** EIP-712 RegisterAccount signature (signRegisterAccount). */
|
|
185
|
+
regSignature: string;
|
|
186
|
+
}
|
|
187
|
+
/** Recommended gasLimit for deployFullOrg — the CLI always sends 15,000,000. */
|
|
188
|
+
export declare const DEPLOY_FULL_ORG_GAS_LIMIT = 15000000;
|
|
189
|
+
/**
|
|
190
|
+
* Pure assembly of the DeploymentParams struct — port of the param build in
|
|
191
|
+
* `pop org deploy` (src/commands/org/deploy.ts:257-403), byte-for-byte the
|
|
192
|
+
* same encoding. Validates taskManagerPerms lengths and every roleAssignments
|
|
193
|
+
* index exactly like the CLI (both gate the broadcast).
|
|
194
|
+
*
|
|
195
|
+
* ABI field order (verified against src/abi/OrgDeployerNew.json +
|
|
196
|
+
* contracts origin/main src/OrgDeployer.sol DeploymentParams):
|
|
197
|
+
* orgId, orgName, metadataHash, registryAddr, deployerAddress,
|
|
198
|
+
* deployerUsername, regDeadline, regNonce, regSignature, autoUpgrade,
|
|
199
|
+
* hybridThresholdPct, ddThresholdPct, hybridClasses, ddInitialTargets,
|
|
200
|
+
* roles, roleAssignments, metadataAdminRoleIndex, passkeyEnabled,
|
|
201
|
+
* educationHubConfig, bootstrap, paymasterConfig, taskManagerPerms
|
|
202
|
+
*/
|
|
203
|
+
export declare function buildDeploymentParams(config: OrgDeployConfig, resolved: DeploymentResolvedInputs): unknown[];
|
|
204
|
+
export interface DeployFullOrgArgs {
|
|
205
|
+
/** OrgDeployer proxy (orgDeployerProxy from infrastructure). */
|
|
206
|
+
orgDeployerAddress: string;
|
|
207
|
+
/** Assembled DeploymentParams struct (buildDeploymentParams). */
|
|
208
|
+
deployParams: unknown[];
|
|
209
|
+
/** Optional paymaster funding ETH (parseEther of paymaster.funding). */
|
|
210
|
+
value?: ethers.BigNumberish;
|
|
211
|
+
orgId?: string;
|
|
212
|
+
orgName?: string;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Port of `pop org deploy` — src/commands/org/deploy.ts.
|
|
216
|
+
* OrgDeployer.deployFullOrg([DeploymentParams]) — the single on-chain write,
|
|
217
|
+
* which internally deploys every org module (registration happens inside it
|
|
218
|
+
* via the EIP-712 signature carried in the params).
|
|
219
|
+
*
|
|
220
|
+
* NOTE: the CLI always sends this with gasLimit 15,000,000
|
|
221
|
+
* (DEPLOY_FULL_ORG_GAS_LIMIT) — pass it in the executor's options; TxIntent
|
|
222
|
+
* carries no gas policy.
|
|
223
|
+
*/
|
|
224
|
+
export declare function buildDeployFullOrg(a: DeployFullOrgArgs): TxIntent;
|
|
225
|
+
export interface DeployFullOrgParams {
|
|
226
|
+
config: OrgDeployConfig;
|
|
227
|
+
/** The deployer wallet address (registered inside deployFullOrg). */
|
|
228
|
+
deployerAddress: string;
|
|
229
|
+
/** Signs the EIP-712 RegisterAccount message; key custody stays host-side. */
|
|
230
|
+
signer: RegisterAccountSigner;
|
|
231
|
+
/**
|
|
232
|
+
* Registration-signature validity in unix seconds. Default now + 900 like
|
|
233
|
+
* the CLI (must survive an interactive confirmation prompt; nonce-bound, so
|
|
234
|
+
* a longer window is not replayable).
|
|
235
|
+
*/
|
|
236
|
+
regDeadline?: number;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Resolved builder for `pop org deploy` — src/commands/org/deploy.ts.
|
|
240
|
+
*
|
|
241
|
+
* Performs the CLI's pre-steps in the same order: config validation,
|
|
242
|
+
* infrastructure address resolution (orgDeployerProxy +
|
|
243
|
+
* globalAccountRegistryProxy), org metadata pin, on-chain
|
|
244
|
+
* UniversalAccountRegistry.nonces() read (requires ctx.provider), and the
|
|
245
|
+
* EIP-712 RegisterAccount signature — then delegates to buildDeployFullOrg.
|
|
246
|
+
*/
|
|
247
|
+
export declare function deployFullOrgIntent(ctx: PopContext, params: DeployFullOrgParams): Promise<TxIntent>;
|
|
248
|
+
export interface UpdateOrgMetaArgs {
|
|
249
|
+
/** OrgRegistry proxy (global infrastructure, not an org module). */
|
|
250
|
+
orgRegistryAddress: string;
|
|
251
|
+
orgId: string;
|
|
252
|
+
/** Full replacement org name (the write overwrites name + metadata). */
|
|
253
|
+
name: string;
|
|
254
|
+
/** bytes32 of the pinned metadata CID. */
|
|
255
|
+
metadataHash: string;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Port of `pop org update-metadata` — src/commands/org/update-metadata.ts.
|
|
259
|
+
* OrgRegistry.updateOrgMetaAsAdmin(orgId, stringToBytes(name), metadataHash).
|
|
260
|
+
* Caller must wear the org's metadata-admin hat (topHat fallback) — revert
|
|
261
|
+
* NotOrgMetadataAdmin otherwise. FULL OVERWRITE of name + metadata hash.
|
|
262
|
+
*/
|
|
263
|
+
export declare function buildUpdateOrgMetaAsAdmin(a: UpdateOrgMetaArgs): TxIntent;
|
|
264
|
+
export interface UpdateOrgMetaParams extends OrgMetadataUpdates {
|
|
265
|
+
/** Org name or 0x id. */
|
|
266
|
+
org: string;
|
|
267
|
+
/** New org name; omitted keeps the current name (full-overwrite write). */
|
|
268
|
+
name?: string;
|
|
269
|
+
/** Raw logo bytes to pin (replaces the CLI's fs.readFileSync path). */
|
|
270
|
+
logo?: Uint8Array;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Resolved builder for `pop org update-metadata` — src/commands/org/update-metadata.ts.
|
|
274
|
+
*
|
|
275
|
+
* Merge base is the RAW IPFS doc (fetchJson of the current metadataHash),
|
|
276
|
+
* spread FIRST so unknown keys (e.g. zkEmailAllowlist) and frontend key order
|
|
277
|
+
* survive; refuses (INFRA) when IPFS is unreachable but the subgraph shows
|
|
278
|
+
* metadata exists — proceeding would drop any key the CLI does not model.
|
|
279
|
+
*/
|
|
280
|
+
export declare function updateOrgMetaIntent(ctx: PopContext, params: UpdateOrgMetaParams): Promise<TxIntent>;
|
|
281
|
+
export interface SetMetadataAdminProposalArgs {
|
|
282
|
+
/** Org HybridVoting module (the proposal target). */
|
|
283
|
+
hybridVotingAddress: string;
|
|
284
|
+
/** OrgRegistry proxy (the option-0 execution target). */
|
|
285
|
+
orgRegistryAddress: string;
|
|
286
|
+
orgId: string;
|
|
287
|
+
/** New metadata-admin hat; 0 clears the override (topHat fallback). */
|
|
288
|
+
hatId: ethers.BigNumberish;
|
|
289
|
+
durationMinutes: ethers.BigNumberish;
|
|
290
|
+
/** Proposal title; default matches the CLI. */
|
|
291
|
+
title?: string;
|
|
292
|
+
/** bytes32 of the pinned proposal metadata CID. */
|
|
293
|
+
descriptionHash: string;
|
|
294
|
+
}
|
|
295
|
+
/** The exact proposal title `pop org set-metadata-admin` uses. */
|
|
296
|
+
export declare function setMetadataAdminTitle(hatId: ethers.BigNumberish): string;
|
|
297
|
+
/**
|
|
298
|
+
* Port of `pop org set-metadata-admin` — src/commands/org/set-metadata-admin.ts.
|
|
299
|
+
*
|
|
300
|
+
* setOrgMetadataAdminHat(bytes32 orgId, uint256 hatId) is executor-only after
|
|
301
|
+
* bootstrap (revert NotOrgExecutor), so it ships as a HybridVoting proposal
|
|
302
|
+
* whose option-0 execution batch calls the OrgRegistry via the executor.
|
|
303
|
+
* Option 1 is "keep current" (empty batch). hatId 0 is meaningful: it clears
|
|
304
|
+
* the override so updateOrgMetaAsAdmin falls back to the org topHat.
|
|
305
|
+
*/
|
|
306
|
+
export declare function buildSetMetadataAdminProposal(a: SetMetadataAdminProposalArgs): TxIntent;
|
|
307
|
+
export interface SetMetadataAdminParams {
|
|
308
|
+
/** Org name or 0x id. */
|
|
309
|
+
org: string;
|
|
310
|
+
/** New metadata-admin hat (decimal/hex); 0 = clear (topHat fallback). */
|
|
311
|
+
hatId: ethers.BigNumberish;
|
|
312
|
+
/** Vote duration in minutes — CLI default 60. */
|
|
313
|
+
durationMinutes?: number;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Resolved builder for `pop org set-metadata-admin` — src/commands/org/set-metadata-admin.ts.
|
|
317
|
+
* Resolves the org's HybridVoting module + the global OrgRegistry, pins the
|
|
318
|
+
* proposal metadata ({description, optionNames, createdAt} — key order is
|
|
319
|
+
* load-bearing), and delegates to buildSetMetadataAdminProposal.
|
|
320
|
+
*/
|
|
321
|
+
export declare function setMetadataAdminIntent(ctx: PopContext, params: SetMetadataAdminParams): Promise<TxIntent>;
|