@trinaryex/mcp 3.8.0 → 4.0.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 +73 -7
- package/dist/capture.d.ts +1 -1
- package/dist/capture.js +1 -1
- package/dist/context.d.ts +10 -2
- package/dist/context.js +2 -1
- package/dist/context.js.map +1 -1
- package/dist/registry.js +34 -2
- package/dist/registry.js.map +1 -1
- package/dist/schemas.d.ts +30 -0
- package/dist/schemas.js +45 -0
- package/dist/schemas.js.map +1 -1
- package/dist/tools/coins.d.ts +2 -0
- package/dist/tools/coins.js +146 -0
- package/dist/tools/coins.js.map +1 -0
- package/dist/tools/coinsPrepare.d.ts +2 -0
- package/dist/tools/coinsPrepare.js +446 -0
- package/dist/tools/coinsPrepare.js.map +1 -0
- package/dist/tools/org.d.ts +2 -0
- package/dist/tools/org.js +422 -0
- package/dist/tools/org.js.map +1 -0
- package/dist/tools/orgCommon.d.ts +144 -0
- package/dist/tools/orgCommon.js +210 -0
- package/dist/tools/orgCommon.js.map +1 -0
- package/dist/tools/orgLifecycle.d.ts +2 -0
- package/dist/tools/orgLifecycle.js +753 -0
- package/dist/tools/orgLifecycle.js.map +1 -0
- package/dist/tools/orgPrepare.d.ts +2 -0
- package/dist/tools/orgPrepare.js +1056 -0
- package/dist/tools/orgPrepare.js.map +1 -0
- package/dist/tools/prepare.d.ts +12 -0
- package/dist/tools/prepare.js +119 -7
- package/dist/tools/prepare.js.map +1 -1
- package/dist/tools/read.js +369 -26
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/world.d.ts +2 -0
- package/dist/tools/world.js +208 -0
- package/dist/tools/world.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,1056 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { big, bigOpt, coinType, objectId, orderSide, suiAddress, u128, u64, } from '../schemas.js';
|
|
3
|
+
import { ACTING_SYNTHETIC, FLAT_CONFIG_SYNTHETIC, PREPARE_SUFFIX, actingShape, assembleConfig, flatConfigShape, openOrg as org, preparedGovernance, proposalConfig, runOptions, runOptionsShape, vaultPrincipal, } from './orgCommon.js';
|
|
4
|
+
/**
|
|
5
|
+
* Armature governance writes, prepared unsigned: membership, proposal-type
|
|
6
|
+
* administration, voting and execution, treasury, trading as the organization,
|
|
7
|
+
* and shared storage. The cycle-7 groups (currency, sub-unit lifecycle, freeze,
|
|
8
|
+
* encrypted entries, upgrades, capabilities, creation) live in
|
|
9
|
+
* `orgLifecycle.ts`.
|
|
10
|
+
*
|
|
11
|
+
* Check `intent.outcome` before assuming a transaction did what you asked. A
|
|
12
|
+
* `proposed` result means the board still has to vote.
|
|
13
|
+
*/
|
|
14
|
+
const orderFlagsShape = {
|
|
15
|
+
orderType: z
|
|
16
|
+
.number()
|
|
17
|
+
.int()
|
|
18
|
+
.min(0)
|
|
19
|
+
.optional()
|
|
20
|
+
.describe('TriexBook order type; 0 (the default) = no restriction.'),
|
|
21
|
+
selfMatchingOption: z
|
|
22
|
+
.number()
|
|
23
|
+
.int()
|
|
24
|
+
.min(0)
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Self-matching option; 0 (the default) = allow.'),
|
|
27
|
+
};
|
|
28
|
+
const itemsOf = (items) => items.map((i) => ({ assetId: big(i.assetId), amount: big(i.amount) }));
|
|
29
|
+
const principalsOf = (ps) => ps?.map((p) => ({ kind: p.kind, value: p.value }));
|
|
30
|
+
const rolePairsOf = (rs) => rs.map((r) => ({
|
|
31
|
+
role: r.role,
|
|
32
|
+
principal: { kind: r.kind, value: r.value },
|
|
33
|
+
}));
|
|
34
|
+
const roleGrant = z.object({
|
|
35
|
+
role: z.enum(['deposit', 'withdraw', 'edit']),
|
|
36
|
+
...vaultPrincipal.shape,
|
|
37
|
+
});
|
|
38
|
+
const addressList = z.array(suiAddress);
|
|
39
|
+
/**
|
|
40
|
+
* The item stacks `orders.sweepAll` will skip, computed the way it computes
|
|
41
|
+
* them. The SDK returns `skipped` beside its `RunOutcome`, but under the
|
|
42
|
+
* capture executor the call never returns, so the list is rebuilt here from
|
|
43
|
+
* the same manifest and the same vault lookup before the build runs.
|
|
44
|
+
*/
|
|
45
|
+
async function predictSweepSkips(ctx, h) {
|
|
46
|
+
const seatId = h.seat?.daoId?.toLowerCase();
|
|
47
|
+
const nodes = h.nodes ?? [];
|
|
48
|
+
const seated = new Set((h.seats ?? []).map((s) => String(s.daoId).toLowerCase()));
|
|
49
|
+
const account = nodes.find((n) => n.tradingAccountId && n.daoId.toLowerCase() === seatId) ??
|
|
50
|
+
nodes.find((n) => n.tradingAccountId && seated.has(n.daoId.toLowerCase())) ??
|
|
51
|
+
nodes.find((n) => n.tradingAccountId);
|
|
52
|
+
if (!account)
|
|
53
|
+
return [];
|
|
54
|
+
const manifest = await ctx.readClient().sweepable(account.tradingAccountId);
|
|
55
|
+
const skipped = [];
|
|
56
|
+
for (const item of manifest.items) {
|
|
57
|
+
const base = {
|
|
58
|
+
storageUnitId: item.storageUnitId,
|
|
59
|
+
assetId: String(item.assetId),
|
|
60
|
+
amount: item.amount,
|
|
61
|
+
};
|
|
62
|
+
if (!item.storageUnitId) {
|
|
63
|
+
skipped.push({ ...base, reason: 'unlinked' });
|
|
64
|
+
}
|
|
65
|
+
else if (!(await h.vault.resolve({ storageUnitId: item.storageUnitId }))) {
|
|
66
|
+
skipped.push({ ...base, reason: 'no-vault' });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return skipped;
|
|
70
|
+
}
|
|
71
|
+
export const orgPrepareTools = [
|
|
72
|
+
// ─── membership ────────────────────────────────────────────────────────────
|
|
73
|
+
{
|
|
74
|
+
name: 'prepare_org_add_members',
|
|
75
|
+
title: 'Prepare: seat members on a unit',
|
|
76
|
+
description: 'Add addresses to a unit’s board (default: the acting seat; unitId targets another unit). Routes through the unit’s own BatchAddMembers or its parent’s ControllerBatchAddMembers, whichever the caller can carry fastest.' +
|
|
77
|
+
PREPARE_SUFFIX,
|
|
78
|
+
kind: 'prepare',
|
|
79
|
+
sdkPath: 'org.members.add',
|
|
80
|
+
inputShape: {
|
|
81
|
+
...actingShape,
|
|
82
|
+
addresses: z.array(suiAddress).min(1),
|
|
83
|
+
...runOptionsShape,
|
|
84
|
+
},
|
|
85
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
86
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_add_members', { orgId: args.orgId, addresses: args.addresses }, async () => (await org(ctx, args)).members.add(args.addresses, runOptions(args))),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'prepare_org_remove_members',
|
|
90
|
+
title: 'Prepare: remove members from a unit',
|
|
91
|
+
description: 'Remove addresses from a unit’s board. Every unit, the root included, has its own BatchRemoveMembers since cycle 7; a parent can also act through ControllerBatchRemoveMembers. Removing a member rotates the unit’s encryption epoch, marking its encrypted entries stale.' +
|
|
92
|
+
PREPARE_SUFFIX,
|
|
93
|
+
kind: 'prepare',
|
|
94
|
+
sdkPath: 'org.members.remove',
|
|
95
|
+
inputShape: {
|
|
96
|
+
...actingShape,
|
|
97
|
+
addresses: z.array(suiAddress).min(1),
|
|
98
|
+
...runOptionsShape,
|
|
99
|
+
},
|
|
100
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
101
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_remove_members', { orgId: args.orgId, addresses: args.addresses }, async () => (await org(ctx, args)).members.remove(args.addresses, runOptions(args))),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'prepare_org_set_board',
|
|
105
|
+
title: 'Prepare: apply a board diff',
|
|
106
|
+
description: 'Apply one board DIFF (SetBoard { to_add, to_remove }) in a single action. A board cannot be replaced wholesale since cycle 7 — the roster is an unenumerable table — so name who joins and who leaves. Give at least one of add / remove.' +
|
|
107
|
+
PREPARE_SUFFIX,
|
|
108
|
+
kind: 'prepare',
|
|
109
|
+
sdkPath: 'org.members.setBoard',
|
|
110
|
+
inputShape: {
|
|
111
|
+
...actingShape,
|
|
112
|
+
add: addressList.optional().describe('Addresses to seat.'),
|
|
113
|
+
remove: addressList.optional().describe('Addresses to unseat.'),
|
|
114
|
+
...runOptionsShape,
|
|
115
|
+
},
|
|
116
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
117
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_set_board', { orgId: args.orgId, add: args.add ?? [], remove: args.remove ?? [] }, async () => (await org(ctx, args)).members.setBoard({ add: args.add, remove: args.remove }, runOptions(args))),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'prepare_org_update_metadata',
|
|
121
|
+
title: 'Prepare: update an organization’s metadata',
|
|
122
|
+
description: 'Point a unit’s charter at a new metadata document. The URI must already be uploaded — this server does not host metadata.' +
|
|
123
|
+
PREPARE_SUFFIX,
|
|
124
|
+
kind: 'prepare',
|
|
125
|
+
sdkPath: 'org.metadata.update',
|
|
126
|
+
inputShape: {
|
|
127
|
+
...actingShape,
|
|
128
|
+
metadataUri: z.string().min(1),
|
|
129
|
+
charterId: objectId.optional(),
|
|
130
|
+
...runOptionsShape,
|
|
131
|
+
},
|
|
132
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
133
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_update_metadata', { orgId: args.orgId, metadataUri: args.metadataUri }, async () => (await org(ctx, args)).metadata.update({
|
|
134
|
+
metadataUri: args.metadataUri,
|
|
135
|
+
charterId: args.charterId,
|
|
136
|
+
...runOptions(args),
|
|
137
|
+
})),
|
|
138
|
+
},
|
|
139
|
+
// ─── proposal-type administration ──────────────────────────────────────────
|
|
140
|
+
{
|
|
141
|
+
name: 'prepare_org_enable_type',
|
|
142
|
+
title: 'Prepare: enable a proposal type',
|
|
143
|
+
description: 'Enable an arbitrary proposal type on a unit with the given voting rules. Quorum and approval are basis points (10000 = 100%); a lone vote can pass a type only when boardSize × quorum ≤ 10000 and executionDelayMs is 0. permissions grants the armature::permissions bits its handler needs — any high-impact bit needs approvalThreshold ≥ 8000.' +
|
|
144
|
+
PREPARE_SUFFIX,
|
|
145
|
+
kind: 'prepare',
|
|
146
|
+
sdkPath: 'org.types.enable',
|
|
147
|
+
inputShape: {
|
|
148
|
+
...actingShape,
|
|
149
|
+
typeKey: z
|
|
150
|
+
.string()
|
|
151
|
+
.min(1)
|
|
152
|
+
.describe('Display key for the slot, e.g. "SetBoard".'),
|
|
153
|
+
moveType: z
|
|
154
|
+
.string()
|
|
155
|
+
.min(1)
|
|
156
|
+
.describe('Fully-qualified Move payload type.'),
|
|
157
|
+
...flatConfigShape,
|
|
158
|
+
composableAllowed: z.boolean().optional(),
|
|
159
|
+
...runOptionsShape,
|
|
160
|
+
},
|
|
161
|
+
syntheticParams: { ...ACTING_SYNTHETIC, ...FLAT_CONFIG_SYNTHETIC },
|
|
162
|
+
derivedParams: {
|
|
163
|
+
config: 'Assembled from the flat quorum / threshold / timing / permission inputs.',
|
|
164
|
+
},
|
|
165
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_enable_type', { orgId: args.orgId, typeKey: args.typeKey }, async () => (await org(ctx, args)).types.enable({
|
|
166
|
+
typeKey: args.typeKey,
|
|
167
|
+
moveType: args.moveType,
|
|
168
|
+
config: assembleConfig(args),
|
|
169
|
+
composableAllowed: args.composableAllowed,
|
|
170
|
+
}, runOptions(args))),
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'prepare_org_disable_type',
|
|
174
|
+
title: 'Prepare: disable a proposal type',
|
|
175
|
+
description: 'Disable a proposal type by display key. The governance meta-types (enable / disable / update config) cannot be disabled.' +
|
|
176
|
+
PREPARE_SUFFIX,
|
|
177
|
+
kind: 'prepare',
|
|
178
|
+
sdkPath: 'org.types.disable',
|
|
179
|
+
inputShape: {
|
|
180
|
+
...actingShape,
|
|
181
|
+
typeKey: z.string().min(1),
|
|
182
|
+
...runOptionsShape,
|
|
183
|
+
},
|
|
184
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
185
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_disable_type', { orgId: args.orgId, typeKey: args.typeKey }, async () => (await org(ctx, args)).types.disable(args.typeKey, runOptions(args))),
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'prepare_org_update_type_config',
|
|
189
|
+
title: 'Prepare: change a proposal type’s rules',
|
|
190
|
+
description: 'Change the voting rules of an already-enabled type. Every field is optional and anything omitted keeps its current value. permissions / borrowScope REPLACE the current set and count as a grant — only a standalone proposal may make one, and framework types’ bits are fixed.' +
|
|
191
|
+
PREPARE_SUFFIX,
|
|
192
|
+
kind: 'prepare',
|
|
193
|
+
sdkPath: 'org.types.updateConfig',
|
|
194
|
+
inputShape: {
|
|
195
|
+
...actingShape,
|
|
196
|
+
typeKey: z.string().min(1),
|
|
197
|
+
quorum: z.number().int().min(0).max(10000).optional(),
|
|
198
|
+
approvalThreshold: z.number().int().min(0).max(10000).optional(),
|
|
199
|
+
proposeThreshold: z.number().int().min(0).optional(),
|
|
200
|
+
expiryMs: z.number().int().min(0).optional(),
|
|
201
|
+
executionDelayMs: z.number().int().min(0).optional(),
|
|
202
|
+
cooldownMs: z.number().int().min(0).optional(),
|
|
203
|
+
composableAllowed: z.boolean().optional(),
|
|
204
|
+
permissions: z.number().int().min(0).optional(),
|
|
205
|
+
borrowScope: z.array(z.string()).optional(),
|
|
206
|
+
...runOptionsShape,
|
|
207
|
+
},
|
|
208
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
209
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_update_type_config', { orgId: args.orgId, typeKey: args.typeKey }, async () => (await org(ctx, args)).types.updateConfig(args.typeKey, {
|
|
210
|
+
quorum: args.quorum,
|
|
211
|
+
approvalThreshold: args.approvalThreshold,
|
|
212
|
+
proposeThreshold: args.proposeThreshold,
|
|
213
|
+
expiryMs: args.expiryMs,
|
|
214
|
+
executionDelayMs: args.executionDelayMs,
|
|
215
|
+
cooldownMs: args.cooldownMs,
|
|
216
|
+
composableAllowed: args.composableAllowed,
|
|
217
|
+
permissions: args.permissions,
|
|
218
|
+
borrowScope: args.borrowScope,
|
|
219
|
+
}, runOptions(args))),
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: 'prepare_org_enable_composite',
|
|
223
|
+
title: 'Prepare: re-enable composite proposals',
|
|
224
|
+
description: 'Enable the Composite type. It is a DEFAULT slot on every cycle-7 unit, so this is only for a unit that disabled it — it is refused when Composite is already enabled (use prepare_org_update_type_config to change its rules).' +
|
|
225
|
+
PREPARE_SUFFIX,
|
|
226
|
+
kind: 'prepare',
|
|
227
|
+
sdkPath: 'org.types.enableComposite',
|
|
228
|
+
inputShape: { ...actingShape, ...runOptionsShape },
|
|
229
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
230
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_enable_composite', { orgId: args.orgId }, async () => (await org(ctx, args)).types.enableComposite(runOptions(args))),
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'prepare_org_enable_send_coin',
|
|
234
|
+
title: 'Prepare: enable treasury withdrawals of a coin',
|
|
235
|
+
description: 'Register SendCoin<T> so the unit can pay that coin out of its treasury to a wallet (80% approval, TREASURY_WITHDRAW). Per-coin: each coin is its own slot.' +
|
|
236
|
+
PREPARE_SUFFIX,
|
|
237
|
+
kind: 'prepare',
|
|
238
|
+
sdkPath: 'org.types.enableSendCoin',
|
|
239
|
+
inputShape: {
|
|
240
|
+
...actingShape,
|
|
241
|
+
coinType: z.string().optional().describe('Defaults to CRED.'),
|
|
242
|
+
...runOptionsShape,
|
|
243
|
+
},
|
|
244
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
245
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_enable_send_coin', { orgId: args.orgId, coinType: args.coinType ?? 'CRED' }, async () => (await org(ctx, args)).types.enableSendCoin(args.coinType, runOptions(args))),
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: 'prepare_org_enable_send_coin_to_org',
|
|
249
|
+
title: 'Prepare: enable treasury-to-treasury sends of a coin',
|
|
250
|
+
description: 'Register SendCoinToOU<T> so the unit can pay that coin into ANOTHER organization’s treasury — the prerequisite for prepare_org_treasury_send_to_org.' +
|
|
251
|
+
PREPARE_SUFFIX,
|
|
252
|
+
kind: 'prepare',
|
|
253
|
+
sdkPath: 'org.types.enableSendCoinToOrg',
|
|
254
|
+
inputShape: {
|
|
255
|
+
...actingShape,
|
|
256
|
+
coinType: z.string().optional().describe('Defaults to CRED.'),
|
|
257
|
+
...runOptionsShape,
|
|
258
|
+
},
|
|
259
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
260
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_enable_send_coin_to_org', { orgId: args.orgId, coinType: args.coinType ?? 'CRED' }, async () => (await org(ctx, args)).types.enableSendCoinToOrg(args.coinType, runOptions(args))),
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: 'prepare_org_enable_send_small_payment',
|
|
264
|
+
title: 'Prepare: enable rate-limited small payments',
|
|
265
|
+
description: 'Register SendSmallPayment<T>: single-vote payouts capped on-chain at 1% of the treasury’s balance per 24h epoch — the cap is what makes one officer’s signature acceptable. Default config is quorum 1 / 80% approval with TREASURY_WITHDRAW; pass config to override.' +
|
|
266
|
+
PREPARE_SUFFIX,
|
|
267
|
+
kind: 'prepare',
|
|
268
|
+
sdkPath: 'org.types.enableSendSmallPayment',
|
|
269
|
+
inputShape: {
|
|
270
|
+
...actingShape,
|
|
271
|
+
coinType: z.string().optional().describe('Defaults to CRED.'),
|
|
272
|
+
config: proposalConfig.optional(),
|
|
273
|
+
...runOptionsShape,
|
|
274
|
+
},
|
|
275
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
276
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_enable_send_small_payment', { orgId: args.orgId, coinType: args.coinType ?? 'CRED' }, async () => (await org(ctx, args)).types.enableSendSmallPayment({ coinType: args.coinType, config: args.config }, runOptions(args))),
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: 'prepare_org_enable_trading',
|
|
280
|
+
title: 'Prepare: enable organization trading',
|
|
281
|
+
description: 'Enable every armature_trading proposal type the unit is missing, in one transaction — the prerequisite for the prepare_org_*order* tools on item markets. Coin-pool pairs are per-pair slots since cycle 7: enable each with prepare_org_enable_coin_pair. Refused when everything is already enabled (organizations created normally already are).' +
|
|
282
|
+
PREPARE_SUFFIX,
|
|
283
|
+
kind: 'prepare',
|
|
284
|
+
sdkPath: 'org.types.enableTrading',
|
|
285
|
+
inputShape: {
|
|
286
|
+
...actingShape,
|
|
287
|
+
quoteType: z.string().optional().describe('Defaults to CRED.'),
|
|
288
|
+
...runOptionsShape,
|
|
289
|
+
},
|
|
290
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
291
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_enable_trading', { orgId: args.orgId, quoteType: args.quoteType ?? 'CRED' }, async () => (await org(ctx, args)).types.enableTrading({ quoteType: args.quoteType }, runOptions(args))),
|
|
292
|
+
},
|
|
293
|
+
// ─── voting and execution ──────────────────────────────────────────────────
|
|
294
|
+
{
|
|
295
|
+
name: 'prepare_org_vote',
|
|
296
|
+
title: 'Prepare: vote on a proposal',
|
|
297
|
+
description: 'Cast a vote on an open proposal. The voter must have been on the board when the proposal was CREATED; voting closes at created + expiry. payloadType and unitId are read from the live proposal when omitted — pass both to skip the read.' +
|
|
298
|
+
PREPARE_SUFFIX,
|
|
299
|
+
kind: 'prepare',
|
|
300
|
+
sdkPath: 'org.governance.vote',
|
|
301
|
+
inputShape: {
|
|
302
|
+
...actingShape,
|
|
303
|
+
proposalId: objectId,
|
|
304
|
+
approve: z.boolean(),
|
|
305
|
+
payloadType: z.string().optional(),
|
|
306
|
+
unitId: objectId.optional().describe('The unit the proposal belongs to.'),
|
|
307
|
+
},
|
|
308
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
309
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vote', { proposalId: args.proposalId, approve: args.approve }, async () => (await org(ctx, args)).governance.vote({
|
|
310
|
+
proposalId: args.proposalId,
|
|
311
|
+
approve: args.approve,
|
|
312
|
+
payloadType: args.payloadType,
|
|
313
|
+
unitId: args.unitId,
|
|
314
|
+
})),
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: 'prepare_org_execute_proposal',
|
|
318
|
+
title: 'Prepare: execute a passed proposal',
|
|
319
|
+
description: 'Execute a proposal the board already passed, dispatching on its payload type to the handler a single-vote run would have used; the proposal is deleted in the same call. A composite runs its whole frame pipeline in one transaction and is refused if any step has no wired executor. Some handlers need an object only the caller can supply: freezeAdminCapId for TransferFreezeAdmin, treasuryCapId for AdoptCurrency, upgrade (the compiled package) for ProposeUpgrade.' +
|
|
320
|
+
PREPARE_SUFFIX,
|
|
321
|
+
kind: 'prepare',
|
|
322
|
+
sdkPath: 'org.governance.execute',
|
|
323
|
+
inputShape: {
|
|
324
|
+
...actingShape,
|
|
325
|
+
proposalId: objectId,
|
|
326
|
+
freezeAdminCapId: objectId
|
|
327
|
+
.optional()
|
|
328
|
+
.describe('TransferFreezeAdmin: the unit’s FreezeAdminCap you own.'),
|
|
329
|
+
treasuryCapId: objectId
|
|
330
|
+
.optional()
|
|
331
|
+
.describe('AdoptCurrency<T>: the TreasuryCap<T> you own.'),
|
|
332
|
+
upgrade: z
|
|
333
|
+
.object({
|
|
334
|
+
modules: z
|
|
335
|
+
.array(z.string())
|
|
336
|
+
.min(1)
|
|
337
|
+
.describe('Base64 module bytecode.'),
|
|
338
|
+
dependencies: z.array(objectId),
|
|
339
|
+
})
|
|
340
|
+
.optional()
|
|
341
|
+
.describe('ProposeUpgrade: the compiled package, as `sui move build --dump-bytecode-as-base64` prints it.'),
|
|
342
|
+
deleteFrame: z
|
|
343
|
+
.boolean()
|
|
344
|
+
.optional()
|
|
345
|
+
.describe('Composites: also delete the exhausted frame (storage rebate to the gas payer).'),
|
|
346
|
+
},
|
|
347
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
348
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_execute_proposal', { proposalId: args.proposalId }, async () => (await org(ctx, args)).governance.execute(args.proposalId, {
|
|
349
|
+
freezeAdminCapId: args.freezeAdminCapId,
|
|
350
|
+
treasuryCapId: args.treasuryCapId,
|
|
351
|
+
upgrade: args.upgrade,
|
|
352
|
+
deleteFrame: args.deleteFrame,
|
|
353
|
+
})),
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: 'prepare_org_delete_expired_proposals',
|
|
357
|
+
title: 'Prepare: delete proposals that can no longer execute',
|
|
358
|
+
description: 'Delete proposals past their window — an Active one past its voting deadline, or a Passed one whose execution window closed (proposal::delete_expired_proposal). PERMISSIONLESS; the storage rebate goes to the gas payer. Several ids clean up in one transaction, but any one not yet expired aborts the whole batch — list candidates with org_expired_proposals first. The indexer reports a lapsed proposal as "pending" until someone does this.' +
|
|
359
|
+
PREPARE_SUFFIX,
|
|
360
|
+
kind: 'prepare',
|
|
361
|
+
sdkPath: 'org.governance.deleteExpired',
|
|
362
|
+
inputShape: {
|
|
363
|
+
...actingShape,
|
|
364
|
+
proposalIds: z.array(objectId).min(1),
|
|
365
|
+
payloadTypes: z
|
|
366
|
+
.record(z.string(), z.string())
|
|
367
|
+
.optional()
|
|
368
|
+
.describe('Payload Move type by proposal id; read from the live objects when omitted.'),
|
|
369
|
+
},
|
|
370
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
371
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_delete_expired_proposals', { proposalIds: args.proposalIds }, async () => (await org(ctx, args)).governance.deleteExpired({
|
|
372
|
+
proposalIds: args.proposalIds,
|
|
373
|
+
payloadTypes: args.payloadTypes,
|
|
374
|
+
})),
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: 'prepare_org_delete_exhausted_frame',
|
|
378
|
+
title: 'Prepare: delete a finished composite frame',
|
|
379
|
+
description: 'Delete a composite’s frame once every step has run (composite::delete_exhausted_frame). Permissionless; rebate to the gas payer. prepare_org_execute_proposal with deleteFrame does the same in the executing transaction.' +
|
|
380
|
+
PREPARE_SUFFIX,
|
|
381
|
+
kind: 'prepare',
|
|
382
|
+
sdkPath: 'org.governance.deleteExhaustedFrame',
|
|
383
|
+
inputShape: { ...actingShape, frameId: objectId },
|
|
384
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
385
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_delete_exhausted_frame', { frameId: args.frameId }, async () => (await org(ctx, args)).governance.deleteExhaustedFrame(args.frameId)),
|
|
386
|
+
},
|
|
387
|
+
// ─── treasury ──────────────────────────────────────────────────────────────
|
|
388
|
+
{
|
|
389
|
+
name: 'prepare_org_treasury_deposit',
|
|
390
|
+
title: 'Prepare: fund an organization treasury',
|
|
391
|
+
description: 'Deposit a coin from the wallet into an organization’s treasury. PERMISSIONLESS — no board seat and no vote; anyone can fund an organization.' +
|
|
392
|
+
PREPARE_SUFFIX,
|
|
393
|
+
kind: 'prepare',
|
|
394
|
+
sdkPath: 'org.treasury.deposit',
|
|
395
|
+
inputShape: {
|
|
396
|
+
...actingShape,
|
|
397
|
+
amount: u64,
|
|
398
|
+
coinType: z.string().optional().describe('Defaults to CRED.'),
|
|
399
|
+
treasuryVaultId: objectId.optional(),
|
|
400
|
+
},
|
|
401
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
402
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_treasury_deposit', { orgId: args.orgId, amount: args.amount }, async () => (await org(ctx, args)).treasury.deposit({
|
|
403
|
+
amount: big(args.amount),
|
|
404
|
+
coinType: args.coinType,
|
|
405
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
406
|
+
})),
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
name: 'prepare_org_treasury_claim',
|
|
410
|
+
title: 'Prepare: claim coins sent to a treasury’s address',
|
|
411
|
+
description: 'Pull coin objects that were transferred to the treasury’s ADDRESS into its balance (treasury_vault::claim_coin). Coins sent that way sit outside the balance until claimed. PERMISSIONLESS, like a deposit.' +
|
|
412
|
+
PREPARE_SUFFIX,
|
|
413
|
+
kind: 'prepare',
|
|
414
|
+
sdkPath: 'org.treasury.claim',
|
|
415
|
+
inputShape: {
|
|
416
|
+
...actingShape,
|
|
417
|
+
coinObjectIds: z.array(objectId).min(1),
|
|
418
|
+
coinType: z.string().optional().describe('Defaults to CRED.'),
|
|
419
|
+
treasuryVaultId: objectId.optional(),
|
|
420
|
+
},
|
|
421
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
422
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_treasury_claim', { orgId: args.orgId, coinObjectIds: args.coinObjectIds }, async () => (await org(ctx, args)).treasury.claim({
|
|
423
|
+
coinObjectIds: args.coinObjectIds,
|
|
424
|
+
coinType: args.coinType,
|
|
425
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
426
|
+
})),
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
name: 'prepare_org_treasury_send',
|
|
430
|
+
title: 'Prepare: pay out of an organization treasury',
|
|
431
|
+
description: 'Pay a coin from the unit’s treasury to a wallet address. Governance-sensitive (80% approval, TREASURY_WITHDRAW): on a real board this resolves to a PROPOSAL rather than an immediate payment — check intent.outcome. Requires the coin’s SendCoin type (prepare_org_enable_send_coin).' +
|
|
432
|
+
PREPARE_SUFFIX,
|
|
433
|
+
kind: 'prepare',
|
|
434
|
+
sdkPath: 'org.treasury.send',
|
|
435
|
+
inputShape: {
|
|
436
|
+
...actingShape,
|
|
437
|
+
recipient: suiAddress,
|
|
438
|
+
amount: u64,
|
|
439
|
+
coinType: z.string().optional(),
|
|
440
|
+
treasuryVaultId: objectId.optional(),
|
|
441
|
+
...runOptionsShape,
|
|
442
|
+
},
|
|
443
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
444
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_treasury_send', { recipient: args.recipient, amount: args.amount }, async () => (await org(ctx, args)).treasury.send({
|
|
445
|
+
recipient: args.recipient,
|
|
446
|
+
amount: big(args.amount),
|
|
447
|
+
coinType: args.coinType,
|
|
448
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
449
|
+
}, runOptions(args))),
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: 'prepare_org_treasury_send_small',
|
|
453
|
+
title: 'Prepare: a rate-limited small payment',
|
|
454
|
+
description: 'Pay a small amount from the treasury to a wallet through SendSmallPayment<T>: at most 1% of the treasury’s balance per 24h epoch, tracked on-chain, which is why a single officer’s vote can carry it. An amount over the remaining allowance aborts on-chain. Requires prepare_org_enable_send_small_payment first.' +
|
|
455
|
+
PREPARE_SUFFIX,
|
|
456
|
+
kind: 'prepare',
|
|
457
|
+
sdkPath: 'org.treasury.sendSmall',
|
|
458
|
+
inputShape: {
|
|
459
|
+
...actingShape,
|
|
460
|
+
recipient: suiAddress,
|
|
461
|
+
amount: u64,
|
|
462
|
+
coinType: z.string().optional(),
|
|
463
|
+
treasuryVaultId: objectId.optional(),
|
|
464
|
+
...runOptionsShape,
|
|
465
|
+
},
|
|
466
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
467
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_treasury_send_small', { recipient: args.recipient, amount: args.amount }, async () => (await org(ctx, args)).treasury.sendSmall({
|
|
468
|
+
recipient: args.recipient,
|
|
469
|
+
amount: big(args.amount),
|
|
470
|
+
coinType: args.coinType,
|
|
471
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
472
|
+
}, runOptions(args))),
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
name: 'prepare_org_treasury_send_to_org',
|
|
476
|
+
title: 'Prepare: pay another organization',
|
|
477
|
+
description: 'Move funds from this unit’s treasury into ANOTHER organization’s treasury. recipientTreasuryId is that organization’s TreasuryVault object id — not its org id and not a wallet; passing either aborts on-chain. Requires SendCoinToOU<T> (prepare_org_enable_send_coin_to_org).' +
|
|
478
|
+
PREPARE_SUFFIX,
|
|
479
|
+
kind: 'prepare',
|
|
480
|
+
sdkPath: 'org.treasury.sendToOrg',
|
|
481
|
+
inputShape: {
|
|
482
|
+
...actingShape,
|
|
483
|
+
recipientTreasuryId: objectId,
|
|
484
|
+
amount: u64,
|
|
485
|
+
coinType: z.string().optional(),
|
|
486
|
+
treasuryVaultId: objectId.optional(),
|
|
487
|
+
...runOptionsShape,
|
|
488
|
+
},
|
|
489
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
490
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_treasury_send_to_org', { recipientTreasuryId: args.recipientTreasuryId, amount: args.amount }, async () => (await org(ctx, args)).treasury.sendToOrg({
|
|
491
|
+
recipientTreasuryId: args.recipientTreasuryId,
|
|
492
|
+
amount: big(args.amount),
|
|
493
|
+
coinType: args.coinType,
|
|
494
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
495
|
+
}, runOptions(args))),
|
|
496
|
+
},
|
|
497
|
+
// ─── trading as the organization ───────────────────────────────────────────
|
|
498
|
+
{
|
|
499
|
+
name: 'prepare_org_setup_trading',
|
|
500
|
+
title: 'Prepare: give an organization a trading account',
|
|
501
|
+
description: 'Create the organization’s shared TradingAccount, owned by a TradingCustody on the ACTING unit — only that unit’s board can trade through it afterwards. Refused when one already exists — check org_trading_account first.' +
|
|
502
|
+
PREPARE_SUFFIX,
|
|
503
|
+
kind: 'prepare',
|
|
504
|
+
sdkPath: 'org.orders.ensureAccount',
|
|
505
|
+
inputShape: { ...actingShape },
|
|
506
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
507
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_setup_trading', { orgId: args.orgId }, async () => (await org(ctx, args)).orders.ensureAccount()),
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: 'prepare_org_limit_order',
|
|
511
|
+
title: 'Prepare: place an organization limit order',
|
|
512
|
+
description: 'Place a limit order on an item market using funds ALREADY in the organization’s trading account. To fund it from the treasury or from shared storage in the same transaction, use prepare_org_buy_from_treasury or prepare_org_sell_from_vault instead. Trading actions never degrade into proposals — if a single vote cannot pass it, the result is prepared:false.' +
|
|
513
|
+
PREPARE_SUFFIX,
|
|
514
|
+
kind: 'prepare',
|
|
515
|
+
sdkPath: 'org.orders.limit',
|
|
516
|
+
inputShape: {
|
|
517
|
+
...actingShape,
|
|
518
|
+
storageUnitId: objectId,
|
|
519
|
+
assetId: z.string(),
|
|
520
|
+
side: orderSide,
|
|
521
|
+
price: u64,
|
|
522
|
+
quantity: u64,
|
|
523
|
+
expireAt: u64
|
|
524
|
+
.optional()
|
|
525
|
+
.describe('Epoch ms; defaults to good-til-cancelled.'),
|
|
526
|
+
quoteType: z.string().optional(),
|
|
527
|
+
...orderFlagsShape,
|
|
528
|
+
},
|
|
529
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
530
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_limit_order', {
|
|
531
|
+
assetId: args.assetId,
|
|
532
|
+
side: args.side,
|
|
533
|
+
price: args.price,
|
|
534
|
+
quantity: args.quantity,
|
|
535
|
+
}, async () => (await org(ctx, args)).orders.limit({
|
|
536
|
+
storageUnitId: args.storageUnitId,
|
|
537
|
+
assetId: args.assetId,
|
|
538
|
+
side: args.side,
|
|
539
|
+
price: big(args.price),
|
|
540
|
+
quantity: big(args.quantity),
|
|
541
|
+
expireAt: bigOpt(args.expireAt),
|
|
542
|
+
quoteType: args.quoteType,
|
|
543
|
+
orderType: args.orderType,
|
|
544
|
+
selfMatchingOption: args.selfMatchingOption,
|
|
545
|
+
})),
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: 'prepare_org_market_order',
|
|
549
|
+
title: 'Prepare: place an organization market order',
|
|
550
|
+
description: 'Place an immediate-or-cancel market order on an item market, using funds already in the trading account. Whatever does not fill at once is cancelled, never left resting.' +
|
|
551
|
+
PREPARE_SUFFIX,
|
|
552
|
+
kind: 'prepare',
|
|
553
|
+
sdkPath: 'org.orders.market',
|
|
554
|
+
inputShape: {
|
|
555
|
+
...actingShape,
|
|
556
|
+
storageUnitId: objectId,
|
|
557
|
+
assetId: z.string(),
|
|
558
|
+
side: orderSide,
|
|
559
|
+
quantity: u64,
|
|
560
|
+
quoteType: z.string().optional(),
|
|
561
|
+
selfMatchingOption: orderFlagsShape.selfMatchingOption,
|
|
562
|
+
},
|
|
563
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
564
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_market_order', { assetId: args.assetId, side: args.side, quantity: args.quantity }, async () => (await org(ctx, args)).orders.market({
|
|
565
|
+
storageUnitId: args.storageUnitId,
|
|
566
|
+
assetId: args.assetId,
|
|
567
|
+
side: args.side,
|
|
568
|
+
quantity: big(args.quantity),
|
|
569
|
+
quoteType: args.quoteType,
|
|
570
|
+
selfMatchingOption: args.selfMatchingOption,
|
|
571
|
+
})),
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: 'prepare_org_cancel_order',
|
|
575
|
+
title: 'Prepare: cancel an organization order',
|
|
576
|
+
description: 'Cancel one of the organization’s resting orders on an item market.' +
|
|
577
|
+
PREPARE_SUFFIX,
|
|
578
|
+
kind: 'prepare',
|
|
579
|
+
sdkPath: 'org.orders.cancel',
|
|
580
|
+
inputShape: {
|
|
581
|
+
...actingShape,
|
|
582
|
+
storageUnitId: objectId,
|
|
583
|
+
assetId: z.string(),
|
|
584
|
+
orderId: u128.describe('Order id (u128) as a decimal string.'),
|
|
585
|
+
quoteType: z.string().optional(),
|
|
586
|
+
},
|
|
587
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
588
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_cancel_order', { assetId: args.assetId, orderId: args.orderId }, async () => (await org(ctx, args)).orders.cancel({
|
|
589
|
+
storageUnitId: args.storageUnitId,
|
|
590
|
+
assetId: args.assetId,
|
|
591
|
+
orderId: big(args.orderId),
|
|
592
|
+
quoteType: args.quoteType,
|
|
593
|
+
})),
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: 'prepare_org_buy_from_treasury',
|
|
597
|
+
title: 'Prepare: fund a bid from the treasury and place it',
|
|
598
|
+
description: 'Move quote coin from the treasury into the trading account and place the bid, ATOMICALLY — if the order aborts the deposit rolls back. depositAmount defaults to the full cost including fees (sized from the pool’s on-chain bid-escrow fee rate, or bidFeeRate when given), NOT to a shortfall: pass the deficit yourself when the trading account already holds some quote. Over-depositing is safe; under-depositing aborts the whole transaction.' +
|
|
599
|
+
PREPARE_SUFFIX,
|
|
600
|
+
kind: 'prepare',
|
|
601
|
+
sdkPath: 'org.orders.buyFromTreasury',
|
|
602
|
+
inputShape: {
|
|
603
|
+
...actingShape,
|
|
604
|
+
storageUnitId: objectId,
|
|
605
|
+
assetId: z.string(),
|
|
606
|
+
price: u64,
|
|
607
|
+
quantity: u64,
|
|
608
|
+
depositAmount: u64.optional(),
|
|
609
|
+
bidFeeRate: u64
|
|
610
|
+
.optional()
|
|
611
|
+
.describe('1e9-scaled fee rate the default deposit is sized with.'),
|
|
612
|
+
expireAt: u64.optional(),
|
|
613
|
+
quoteType: z.string().optional(),
|
|
614
|
+
treasuryVaultId: objectId.optional(),
|
|
615
|
+
...orderFlagsShape,
|
|
616
|
+
},
|
|
617
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
618
|
+
derivedParams: { side: 'Always "buy" — this tool funds a bid.' },
|
|
619
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_buy_from_treasury', { assetId: args.assetId, price: args.price, quantity: args.quantity }, async () => (await org(ctx, args)).orders.buyFromTreasury({
|
|
620
|
+
storageUnitId: args.storageUnitId,
|
|
621
|
+
assetId: args.assetId,
|
|
622
|
+
side: 'buy',
|
|
623
|
+
price: big(args.price),
|
|
624
|
+
quantity: big(args.quantity),
|
|
625
|
+
depositAmount: bigOpt(args.depositAmount),
|
|
626
|
+
bidFeeRate: bigOpt(args.bidFeeRate),
|
|
627
|
+
expireAt: bigOpt(args.expireAt),
|
|
628
|
+
quoteType: args.quoteType,
|
|
629
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
630
|
+
orderType: args.orderType,
|
|
631
|
+
selfMatchingOption: args.selfMatchingOption,
|
|
632
|
+
})),
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: 'prepare_org_sell_from_vault',
|
|
636
|
+
title: 'Prepare: unpark from shared storage and sell',
|
|
637
|
+
description: 'Take items out of the organization’s shared storage and place the ask, ATOMICALLY. vaultQuantity is how much to pull from the vault, which is not always the order quantity — the trading account may already hold part of the stack. The vault is resolved from the storage unit and this organization unless vaultId is given; the trading unit’s board must satisfy its withdraw role.' +
|
|
638
|
+
PREPARE_SUFFIX,
|
|
639
|
+
kind: 'prepare',
|
|
640
|
+
sdkPath: 'org.orders.sellFromVault',
|
|
641
|
+
inputShape: {
|
|
642
|
+
...actingShape,
|
|
643
|
+
storageUnitId: objectId,
|
|
644
|
+
assetId: z.string(),
|
|
645
|
+
price: u64,
|
|
646
|
+
quantity: u64,
|
|
647
|
+
vaultQuantity: u64.optional(),
|
|
648
|
+
vaultId: objectId.optional(),
|
|
649
|
+
registrantOrgId: objectId
|
|
650
|
+
.optional()
|
|
651
|
+
.describe('Pin the unit that registered the vault.'),
|
|
652
|
+
expireAt: u64.optional(),
|
|
653
|
+
quoteType: z.string().optional(),
|
|
654
|
+
...orderFlagsShape,
|
|
655
|
+
},
|
|
656
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
657
|
+
derivedParams: { side: 'Always "sell" — this tool places an ask.' },
|
|
658
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_sell_from_vault', { assetId: args.assetId, price: args.price, quantity: args.quantity }, async () => (await org(ctx, args)).orders.sellFromVault({
|
|
659
|
+
storageUnitId: args.storageUnitId,
|
|
660
|
+
assetId: args.assetId,
|
|
661
|
+
side: 'sell',
|
|
662
|
+
price: big(args.price),
|
|
663
|
+
quantity: big(args.quantity),
|
|
664
|
+
vaultQuantity: bigOpt(args.vaultQuantity),
|
|
665
|
+
vaultId: args.vaultId,
|
|
666
|
+
registrantOrgId: args.registrantOrgId,
|
|
667
|
+
expireAt: bigOpt(args.expireAt),
|
|
668
|
+
quoteType: args.quoteType,
|
|
669
|
+
orderType: args.orderType,
|
|
670
|
+
selfMatchingOption: args.selfMatchingOption,
|
|
671
|
+
})),
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: 'prepare_org_deposit_to_trading',
|
|
675
|
+
title: 'Prepare: move treasury coin into the trading account',
|
|
676
|
+
description: 'Move a coin from the treasury into the organization’s trading account on its own — e.g. a coin pool’s BASE coin ahead of an ask. Bids on item markets are better served by prepare_org_buy_from_treasury, which funds and places at once. Requires DepositCoinToBook<T> for that coin.' +
|
|
677
|
+
PREPARE_SUFFIX,
|
|
678
|
+
kind: 'prepare',
|
|
679
|
+
sdkPath: 'org.orders.deposit',
|
|
680
|
+
inputShape: {
|
|
681
|
+
...actingShape,
|
|
682
|
+
amount: u64,
|
|
683
|
+
coinType: z.string().optional().describe('Defaults to CRED.'),
|
|
684
|
+
treasuryVaultId: objectId.optional(),
|
|
685
|
+
},
|
|
686
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
687
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_deposit_to_trading', { amount: args.amount, coinType: args.coinType ?? 'CRED' }, async () => (await org(ctx, args)).orders.deposit({
|
|
688
|
+
amount: big(args.amount),
|
|
689
|
+
coinType: args.coinType,
|
|
690
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
691
|
+
})),
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
name: 'prepare_org_enable_coin_pair',
|
|
695
|
+
title: 'Prepare: enable trading of one coin pair',
|
|
696
|
+
description: 'Register PlaceLimitOrderCoin<Base, Quote> and CancelOrderCoin<Base, Quote> on the acting unit under per-pair keys, so further pairs can be added later. The prerequisite for prepare_org_coin_limit_order / prepare_org_coin_cancel_order on that pair. Refused when the pair is already enabled.' +
|
|
697
|
+
PREPARE_SUFFIX,
|
|
698
|
+
kind: 'prepare',
|
|
699
|
+
sdkPath: 'org.orders.enableCoinPair',
|
|
700
|
+
inputShape: {
|
|
701
|
+
...actingShape,
|
|
702
|
+
baseType: coinType,
|
|
703
|
+
quoteType: coinType.optional().describe('Defaults to CRED.'),
|
|
704
|
+
},
|
|
705
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
706
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_enable_coin_pair', { baseType: args.baseType, quoteType: args.quoteType ?? 'CRED' }, async () => (await org(ctx, args)).orders.enableCoinPair({
|
|
707
|
+
baseType: args.baseType,
|
|
708
|
+
quoteType: args.quoteType,
|
|
709
|
+
})),
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
name: 'prepare_org_coin_limit_order',
|
|
713
|
+
title: 'Prepare: place an organization coin-pool limit order',
|
|
714
|
+
description: 'Place a limit order on a COIN pool (Pool<Base, Quote>) as the organization. Coin units: amounts are raw base units and price is 1e9-scaled. With depositAmount the order is funded from the treasury in the same transaction — quote for a bid, base for an ask (which then also needs DepositCoinToBook<Base>). Requires the pair enabled (prepare_org_enable_coin_pair).' +
|
|
715
|
+
PREPARE_SUFFIX,
|
|
716
|
+
kind: 'prepare',
|
|
717
|
+
sdkPath: 'org.orders.limitCoin',
|
|
718
|
+
inputShape: {
|
|
719
|
+
...actingShape,
|
|
720
|
+
poolId: objectId,
|
|
721
|
+
baseType: coinType,
|
|
722
|
+
quoteType: coinType.optional().describe('Defaults to CRED.'),
|
|
723
|
+
side: orderSide,
|
|
724
|
+
price: u64.describe('1e9-scaled price.'),
|
|
725
|
+
quantity: u64.describe('Raw base units.'),
|
|
726
|
+
expireAt: u64
|
|
727
|
+
.optional()
|
|
728
|
+
.describe('Epoch ms; defaults to good-til-cancelled.'),
|
|
729
|
+
depositAmount: u64.optional(),
|
|
730
|
+
treasuryVaultId: objectId.optional(),
|
|
731
|
+
...orderFlagsShape,
|
|
732
|
+
},
|
|
733
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
734
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_coin_limit_order', {
|
|
735
|
+
poolId: args.poolId,
|
|
736
|
+
side: args.side,
|
|
737
|
+
price: args.price,
|
|
738
|
+
quantity: args.quantity,
|
|
739
|
+
}, async () => (await org(ctx, args)).orders.limitCoin({
|
|
740
|
+
poolId: args.poolId,
|
|
741
|
+
baseType: args.baseType,
|
|
742
|
+
quoteType: args.quoteType,
|
|
743
|
+
side: args.side,
|
|
744
|
+
price: big(args.price),
|
|
745
|
+
quantity: big(args.quantity),
|
|
746
|
+
expireAt: bigOpt(args.expireAt),
|
|
747
|
+
depositAmount: bigOpt(args.depositAmount),
|
|
748
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
749
|
+
orderType: args.orderType,
|
|
750
|
+
selfMatchingOption: args.selfMatchingOption,
|
|
751
|
+
})),
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: 'prepare_org_coin_cancel_order',
|
|
755
|
+
title: 'Prepare: cancel an organization coin-pool order',
|
|
756
|
+
description: 'Cancel one of the organization’s resting orders on a coin pool.' +
|
|
757
|
+
PREPARE_SUFFIX,
|
|
758
|
+
kind: 'prepare',
|
|
759
|
+
sdkPath: 'org.orders.cancelCoin',
|
|
760
|
+
inputShape: {
|
|
761
|
+
...actingShape,
|
|
762
|
+
poolId: objectId,
|
|
763
|
+
baseType: coinType,
|
|
764
|
+
quoteType: coinType.optional().describe('Defaults to CRED.'),
|
|
765
|
+
orderId: u128.describe('Order id (u128) as a decimal string.'),
|
|
766
|
+
},
|
|
767
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
768
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_coin_cancel_order', { poolId: args.poolId, orderId: args.orderId }, async () => (await org(ctx, args)).orders.cancelCoin({
|
|
769
|
+
poolId: args.poolId,
|
|
770
|
+
baseType: args.baseType,
|
|
771
|
+
quoteType: args.quoteType,
|
|
772
|
+
orderId: big(args.orderId),
|
|
773
|
+
})),
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: 'prepare_org_create_pool',
|
|
777
|
+
title: 'Prepare: open a new item market as the organization',
|
|
778
|
+
description: 'Open a permissionless MultiCoinPool<Quote> for one asset of a hub’s collection, paying the CRED creation fee from the ACTING unit’s treasury. Give storageUnitId (the collection is looked up) or collectionId. Requires CreateMulticoinPool<Quote> with TREASURY_WITHDRAW. May resolve to a PROPOSAL — a new market does not go stale while a board votes — so check intent.outcome.' +
|
|
779
|
+
PREPARE_SUFFIX,
|
|
780
|
+
kind: 'prepare',
|
|
781
|
+
sdkPath: 'org.orders.createPool',
|
|
782
|
+
inputShape: {
|
|
783
|
+
...actingShape,
|
|
784
|
+
assetId: u64.describe('Item asset id as a decimal string.'),
|
|
785
|
+
storageUnitId: objectId.optional(),
|
|
786
|
+
collectionId: objectId.optional(),
|
|
787
|
+
quoteType: z.string().optional().describe('Defaults to CRED.'),
|
|
788
|
+
treasuryVaultId: objectId.optional(),
|
|
789
|
+
},
|
|
790
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
791
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_create_pool', { assetId: args.assetId }, async () => (await org(ctx, args)).orders.createPool({
|
|
792
|
+
assetId: big(args.assetId),
|
|
793
|
+
storageUnitId: args.storageUnitId,
|
|
794
|
+
collectionId: args.collectionId,
|
|
795
|
+
quoteType: args.quoteType,
|
|
796
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
797
|
+
})),
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
name: 'prepare_org_sweep_coin',
|
|
801
|
+
title: 'Prepare: sweep a coin to the treasury',
|
|
802
|
+
description: 'Move a coin out of the trading account back into the treasury — quote proceeds, or a coin pool’s base coin (coinType, default CRED). claimFromPool (an item market) / claimFromCoinPool (a coin pool) first claim that pool’s settled balances in the same transaction — a resting maker order that filled leaves its proceeds IN the pool, so sweeping without claiming quietly moves less than expected.' +
|
|
803
|
+
PREPARE_SUFFIX,
|
|
804
|
+
kind: 'prepare',
|
|
805
|
+
sdkPath: 'org.orders.sweepCoin',
|
|
806
|
+
inputShape: {
|
|
807
|
+
...actingShape,
|
|
808
|
+
amount: u64,
|
|
809
|
+
coinType: z.string().optional().describe('Defaults to CRED.'),
|
|
810
|
+
treasuryVaultId: objectId.optional(),
|
|
811
|
+
claimFromPool: objectId
|
|
812
|
+
.optional()
|
|
813
|
+
.describe('An item market (MultiCoinPool<coinType>) to claim from.'),
|
|
814
|
+
claimFromCoinPool: z
|
|
815
|
+
.object({
|
|
816
|
+
poolId: objectId,
|
|
817
|
+
baseType: coinType,
|
|
818
|
+
quoteType: coinType.optional(),
|
|
819
|
+
})
|
|
820
|
+
.optional()
|
|
821
|
+
.describe('A coin pool to claim from.'),
|
|
822
|
+
},
|
|
823
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
824
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_sweep_coin', { amount: args.amount, coinType: args.coinType ?? 'CRED' }, async () => (await org(ctx, args)).orders.sweepCoin({
|
|
825
|
+
amount: big(args.amount),
|
|
826
|
+
coinType: args.coinType,
|
|
827
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
828
|
+
claimFromPool: args.claimFromPool,
|
|
829
|
+
claimFromCoinPool: args.claimFromCoinPool,
|
|
830
|
+
})),
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
name: 'prepare_org_sweep_items',
|
|
834
|
+
title: 'Prepare: park items in shared storage',
|
|
835
|
+
description: 'Move an item stack out of the trading account into the organization’s shared storage at a hub. The trading unit’s board must satisfy the vault’s deposit role. As with the coin sweep, claimFromPool claims settled balances first so the amount may include them.' +
|
|
836
|
+
PREPARE_SUFFIX,
|
|
837
|
+
kind: 'prepare',
|
|
838
|
+
sdkPath: 'org.orders.sweepItems',
|
|
839
|
+
inputShape: {
|
|
840
|
+
...actingShape,
|
|
841
|
+
storageUnitId: objectId,
|
|
842
|
+
assetId: u64,
|
|
843
|
+
amount: u64,
|
|
844
|
+
vaultId: objectId.optional(),
|
|
845
|
+
registrantOrgId: objectId.optional(),
|
|
846
|
+
collectionId: objectId.optional(),
|
|
847
|
+
claimFromPool: objectId.optional(),
|
|
848
|
+
quoteType: z.string().optional(),
|
|
849
|
+
},
|
|
850
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
851
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_sweep_items', { assetId: args.assetId, amount: args.amount }, async () => (await org(ctx, args)).orders.sweepItems({
|
|
852
|
+
storageUnitId: args.storageUnitId,
|
|
853
|
+
assetId: big(args.assetId),
|
|
854
|
+
amount: big(args.amount),
|
|
855
|
+
vaultId: args.vaultId,
|
|
856
|
+
registrantOrgId: args.registrantOrgId,
|
|
857
|
+
collectionId: args.collectionId,
|
|
858
|
+
claimFromPool: args.claimFromPool,
|
|
859
|
+
quoteType: args.quoteType,
|
|
860
|
+
})),
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: 'prepare_org_sweep_all',
|
|
864
|
+
title: 'Prepare: park everything the organization is idly holding',
|
|
865
|
+
description: 'One signature: claim every pool’s settled proceeds, park each item stack in its shared storage, and send the aggregate quote coin to the treasury. Item stacks with no resolvable vault are REPORTED in intent.params.skipped, not silently dropped. The manifest lags chain head by seconds, so a very recent fill may be missed — run it again rather than widening amounts by hand.' +
|
|
866
|
+
PREPARE_SUFFIX,
|
|
867
|
+
kind: 'prepare',
|
|
868
|
+
sdkPath: 'org.orders.sweepAll',
|
|
869
|
+
inputShape: {
|
|
870
|
+
...actingShape,
|
|
871
|
+
quoteType: z.string().optional(),
|
|
872
|
+
treasuryVaultId: objectId.optional(),
|
|
873
|
+
includeCurrency: z.boolean().optional(),
|
|
874
|
+
},
|
|
875
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
876
|
+
handler: async (ctx, args) => {
|
|
877
|
+
const h = await org(ctx, args);
|
|
878
|
+
const skipped = await predictSweepSkips(ctx, h);
|
|
879
|
+
return preparedGovernance(ctx, args.sender, 'org_sweep_all', { orgId: args.orgId, skipped }, () => h.orders.sweepAll({
|
|
880
|
+
quoteType: args.quoteType,
|
|
881
|
+
treasuryVaultId: args.treasuryVaultId,
|
|
882
|
+
includeCurrency: args.includeCurrency,
|
|
883
|
+
}));
|
|
884
|
+
},
|
|
885
|
+
},
|
|
886
|
+
// ─── shared storage ────────────────────────────────────────────────────────
|
|
887
|
+
{
|
|
888
|
+
name: 'prepare_org_vault_init',
|
|
889
|
+
title: 'Prepare: open shared storage for an organization',
|
|
890
|
+
description: 'Register a receipt vault for the acting unit at a storage unit. Any board member of the acting unit may do this. Deposit and withdraw default to the acting unit; EDIT defaults to its PARENT, because a unit that governs its own access control can quietly widen it. At least one editor is required.' +
|
|
891
|
+
PREPARE_SUFFIX,
|
|
892
|
+
kind: 'prepare',
|
|
893
|
+
sdkPath: 'org.vault.init',
|
|
894
|
+
inputShape: {
|
|
895
|
+
...actingShape,
|
|
896
|
+
storageUnitId: objectId,
|
|
897
|
+
vaultConfigId: objectId.optional(),
|
|
898
|
+
depositPrincipals: z
|
|
899
|
+
.array(vaultPrincipal)
|
|
900
|
+
.optional()
|
|
901
|
+
.describe('Defaults to the acting unit.'),
|
|
902
|
+
withdrawPrincipals: z
|
|
903
|
+
.array(vaultPrincipal)
|
|
904
|
+
.optional()
|
|
905
|
+
.describe('Defaults to the acting unit.'),
|
|
906
|
+
editPrincipals: z
|
|
907
|
+
.array(vaultPrincipal)
|
|
908
|
+
.min(1)
|
|
909
|
+
.optional()
|
|
910
|
+
.describe('Defaults to the acting unit’s parent (itself at the root).'),
|
|
911
|
+
},
|
|
912
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
913
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vault_init', { orgId: args.orgId, storageUnitId: args.storageUnitId }, async () => (await org(ctx, args)).vault.init({
|
|
914
|
+
storageUnitId: args.storageUnitId,
|
|
915
|
+
vaultConfigId: args.vaultConfigId,
|
|
916
|
+
depositPrincipals: principalsOf(args.depositPrincipals),
|
|
917
|
+
withdrawPrincipals: principalsOf(args.withdrawPrincipals),
|
|
918
|
+
editPrincipals: principalsOf(args.editPrincipals),
|
|
919
|
+
})),
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
name: 'prepare_org_vault_deposit',
|
|
923
|
+
title: 'Prepare: move wallet items into shared storage',
|
|
924
|
+
description: 'Deposit items from the CALLER’S WALLET receipts into the organization’s shared storage. Not governance — the vault’s deposit role is checked against the caller directly. To move items out of the organization’s trading account instead, use prepare_org_sweep_items.' +
|
|
925
|
+
PREPARE_SUFFIX,
|
|
926
|
+
kind: 'prepare',
|
|
927
|
+
sdkPath: 'org.vault.deposit',
|
|
928
|
+
inputShape: {
|
|
929
|
+
...actingShape,
|
|
930
|
+
storageUnitId: objectId,
|
|
931
|
+
items: z
|
|
932
|
+
.array(z.object({ assetId: u64, amount: u64 }))
|
|
933
|
+
.min(1)
|
|
934
|
+
.describe('Asset ids and amounts, as decimal strings.'),
|
|
935
|
+
registrantOrgId: objectId.optional(),
|
|
936
|
+
vaultId: objectId.optional(),
|
|
937
|
+
},
|
|
938
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
939
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vault_deposit', { storageUnitId: args.storageUnitId, items: args.items }, async () => (await org(ctx, args)).vault.deposit({
|
|
940
|
+
storageUnitId: args.storageUnitId,
|
|
941
|
+
items: itemsOf(args.items),
|
|
942
|
+
registrantOrgId: args.registrantOrgId,
|
|
943
|
+
vaultId: args.vaultId,
|
|
944
|
+
})),
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
name: 'prepare_org_vault_withdraw',
|
|
948
|
+
title: 'Prepare: take items out of shared storage',
|
|
949
|
+
description: 'Withdraw items from the organization’s shared storage. "wallet" (the default) transfers the receipt objects to the caller; "hangar" redeems them into the storage unit’s inventory instead and needs a characterId.' +
|
|
950
|
+
PREPARE_SUFFIX,
|
|
951
|
+
kind: 'prepare',
|
|
952
|
+
sdkPath: 'org.vault.withdraw',
|
|
953
|
+
inputShape: {
|
|
954
|
+
...actingShape,
|
|
955
|
+
storageUnitId: objectId,
|
|
956
|
+
items: z.array(z.object({ assetId: u64, amount: u64 })).min(1),
|
|
957
|
+
to: z.enum(['wallet', 'hangar']).optional(),
|
|
958
|
+
characterId: objectId.optional(),
|
|
959
|
+
registrantOrgId: objectId.optional(),
|
|
960
|
+
vaultId: objectId.optional(),
|
|
961
|
+
},
|
|
962
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
963
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vault_withdraw', { storageUnitId: args.storageUnitId, to: args.to ?? 'wallet' }, async () => (await org(ctx, args)).vault.withdraw({
|
|
964
|
+
storageUnitId: args.storageUnitId,
|
|
965
|
+
items: itemsOf(args.items),
|
|
966
|
+
to: args.to,
|
|
967
|
+
characterId: args.characterId,
|
|
968
|
+
registrantOrgId: args.registrantOrgId,
|
|
969
|
+
vaultId: args.vaultId,
|
|
970
|
+
})),
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
name: 'prepare_org_vault_grant',
|
|
974
|
+
title: 'Prepare: grant shared-storage access',
|
|
975
|
+
description: 'Grant (role, principal) pairs on a vault. The caller must satisfy the edit role through editorOuId (default: the acting seat). A principal is a wallet ("player"), a bot/service key ("machine"), or an organization unit ("ou"). Granting EDIT to an organization goes through a witnessed path that requires a live OU, so a mistyped org id cannot become an unsatisfiable editor.' +
|
|
976
|
+
PREPARE_SUFFIX,
|
|
977
|
+
kind: 'prepare',
|
|
978
|
+
sdkPath: 'org.vault.grant',
|
|
979
|
+
inputShape: {
|
|
980
|
+
...actingShape,
|
|
981
|
+
vaultId: objectId,
|
|
982
|
+
grants: z.array(roleGrant).min(1),
|
|
983
|
+
editorOuId: objectId
|
|
984
|
+
.optional()
|
|
985
|
+
.describe('The unit whose board satisfies edit; defaults to the seat.'),
|
|
986
|
+
},
|
|
987
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
988
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vault_grant', { vaultId: args.vaultId, grants: args.grants }, async () => (await org(ctx, args)).vault.grant({
|
|
989
|
+
vaultId: args.vaultId,
|
|
990
|
+
grants: rolePairsOf(args.grants),
|
|
991
|
+
editorOuId: args.editorOuId,
|
|
992
|
+
})),
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
name: 'prepare_org_vault_revoke',
|
|
996
|
+
title: 'Prepare: revoke shared-storage access',
|
|
997
|
+
description: 'Revoke (role, principal) pairs. Aborts rather than leave edit empty or the caller unable to administer the vault through editorOuId. Pairs not present are skipped — and player(A) and machine(A) are DISTINCT principals for the same address, so name the kind that was granted.' +
|
|
998
|
+
PREPARE_SUFFIX,
|
|
999
|
+
kind: 'prepare',
|
|
1000
|
+
sdkPath: 'org.vault.revoke',
|
|
1001
|
+
inputShape: {
|
|
1002
|
+
...actingShape,
|
|
1003
|
+
vaultId: objectId,
|
|
1004
|
+
revocations: z.array(roleGrant).min(1),
|
|
1005
|
+
editorOuId: objectId.optional(),
|
|
1006
|
+
},
|
|
1007
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
1008
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vault_revoke', { vaultId: args.vaultId, revocations: args.revocations }, async () => (await org(ctx, args)).vault.revoke({
|
|
1009
|
+
vaultId: args.vaultId,
|
|
1010
|
+
revocations: rolePairsOf(args.revocations),
|
|
1011
|
+
editorOuId: args.editorOuId,
|
|
1012
|
+
})),
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
name: 'prepare_org_vault_rekey',
|
|
1016
|
+
title: 'Prepare: file shared storage under another unit',
|
|
1017
|
+
description: 'File a vault under a different registrant organization — after migrating to a new unit, so lookups by (storage unit, organization) find it there. The ACL is untouched; grant the new unit access separately. Requires edit through editorOuId (default: the acting seat).' +
|
|
1018
|
+
PREPARE_SUFFIX,
|
|
1019
|
+
kind: 'prepare',
|
|
1020
|
+
sdkPath: 'org.vault.rekey',
|
|
1021
|
+
inputShape: {
|
|
1022
|
+
...actingShape,
|
|
1023
|
+
vaultId: objectId,
|
|
1024
|
+
newRegistrantOrgId: objectId,
|
|
1025
|
+
editorOuId: objectId.optional(),
|
|
1026
|
+
},
|
|
1027
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
1028
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vault_rekey', {
|
|
1029
|
+
vaultId: args.vaultId,
|
|
1030
|
+
newRegistrantOrgId: args.newRegistrantOrgId,
|
|
1031
|
+
}, async () => (await org(ctx, args)).vault.rekey({
|
|
1032
|
+
vaultId: args.vaultId,
|
|
1033
|
+
newRegistrantOrgId: args.newRegistrantOrgId,
|
|
1034
|
+
editorOuId: args.editorOuId,
|
|
1035
|
+
})),
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
name: 'prepare_org_vault_deinit',
|
|
1039
|
+
title: 'Prepare: retire shared storage',
|
|
1040
|
+
description: 'Retire an EMPTY vault and free its registry slot. Aborts on-chain if the vault still holds anything.' +
|
|
1041
|
+
PREPARE_SUFFIX,
|
|
1042
|
+
kind: 'prepare',
|
|
1043
|
+
sdkPath: 'org.vault.deinit',
|
|
1044
|
+
inputShape: {
|
|
1045
|
+
...actingShape,
|
|
1046
|
+
vaultId: objectId,
|
|
1047
|
+
editorOuId: objectId.optional(),
|
|
1048
|
+
},
|
|
1049
|
+
syntheticParams: ACTING_SYNTHETIC,
|
|
1050
|
+
handler: (ctx, args) => preparedGovernance(ctx, args.sender, 'org_vault_deinit', { vaultId: args.vaultId }, async () => (await org(ctx, args)).vault.deinit({
|
|
1051
|
+
vaultId: args.vaultId,
|
|
1052
|
+
editorOuId: args.editorOuId,
|
|
1053
|
+
})),
|
|
1054
|
+
},
|
|
1055
|
+
];
|
|
1056
|
+
//# sourceMappingURL=orgPrepare.js.map
|