@trinaryex/sdk 3.9.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/DESIGN.md +253 -71
- package/README.md +218 -16
- package/dist/ReadOnlyClient.d.ts +42 -8
- package/dist/TriexClient.d.ts +73 -8
- package/dist/armature/OrgClient.d.ts +372 -0
- package/dist/armature/OrgClientGroups.d.ts +186 -0
- package/dist/armature/OrgsApi.d.ts +69 -0
- package/dist/armature/actions.d.ts +75 -0
- package/dist/armature/create.d.ts +27 -0
- package/dist/armature/currency.d.ts +64 -0
- package/dist/armature/executors.d.ts +44 -0
- package/dist/armature/governance.d.ts +194 -0
- package/dist/armature/harness.d.ts +96 -0
- package/dist/armature/lifecycle.d.ts +84 -0
- package/dist/armature/plan.d.ts +39 -0
- package/dist/armature/proposals.d.ts +51 -0
- package/dist/armature/queries.d.ts +16 -0
- package/dist/armature/schemas.d.ts +559 -0
- package/dist/armature/trading.d.ts +114 -0
- package/dist/armature/transactions.d.ts +160 -0
- package/dist/armature/treasury.d.ts +41 -0
- package/dist/armature/tree.d.ts +13 -0
- package/dist/armature/types.d.ts +59 -0
- package/dist/armature/upgrade.d.ts +27 -0
- package/dist/armature/vault.d.ts +94 -0
- package/dist/coins/CoinsApi.d.ts +53 -0
- package/dist/coins/funding.d.ts +6 -0
- package/dist/coins/money.d.ts +36 -0
- package/dist/coins/onchain.d.ts +162 -0
- package/dist/coins/schemas.d.ts +456 -0
- package/dist/coins/transactions.d.ts +82 -0
- package/dist/coins/types.d.ts +115 -0
- package/dist/errors.d.ts +11 -1
- package/dist/funding.d.ts +2 -2
- package/dist/http.d.ts +3 -0
- package/dist/index.d.ts +63 -8
- package/dist/index.js +10587 -959
- package/dist/money.d.ts +15 -0
- package/dist/moveAbort.d.ts +28 -0
- package/dist/moveAbortCatalog.generated.d.ts +9 -0
- package/dist/onchain.d.ts +55 -3
- package/dist/paging.d.ts +9 -3
- package/dist/queries.d.ts +35 -7
- package/dist/schemas.d.ts +1911 -50
- package/dist/transactions.d.ts +63 -1
- package/dist/types.d.ts +116 -7
- package/package.json +3 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { ProposalConfigInput } from './transactions';
|
|
3
|
+
export interface TypeInitInput {
|
|
4
|
+
moveType: string;
|
|
5
|
+
displayKey: string;
|
|
6
|
+
config: ProposalConfigInput;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateTribeParams {
|
|
9
|
+
armature: string;
|
|
10
|
+
armatureProposals: string;
|
|
11
|
+
tribeBoard: string[];
|
|
12
|
+
officers: string[];
|
|
13
|
+
members: string[];
|
|
14
|
+
tribeName: string;
|
|
15
|
+
officerName: string;
|
|
16
|
+
memberName: string;
|
|
17
|
+
tribeMetadataUri: string;
|
|
18
|
+
officerMetadataUri: string;
|
|
19
|
+
memberMetadataUri: string;
|
|
20
|
+
officerFreezeAdmin: string;
|
|
21
|
+
memberFreezeAdmin: string;
|
|
22
|
+
tribeOverrides?: TypeInitInput[];
|
|
23
|
+
officerOverrides?: TypeInitInput[];
|
|
24
|
+
memberOverrides?: TypeInitInput[];
|
|
25
|
+
}
|
|
26
|
+
export declare function createTribeTx(p: CreateTribeParams): Transaction;
|
|
27
|
+
export declare function tradingTypeInits(armatureTrading: string, quoteType: string): TypeInitInput[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { ArmaturePkgs } from './actions';
|
|
3
|
+
import { OuProposalAction } from './harness';
|
|
4
|
+
import { ProposalConfigInput } from './transactions';
|
|
5
|
+
export declare function treasuryCapType(coinType: string): string;
|
|
6
|
+
export interface CurrencyTypeEntry {
|
|
7
|
+
typeKey: string;
|
|
8
|
+
moveType: string;
|
|
9
|
+
config: ProposalConfigInput;
|
|
10
|
+
}
|
|
11
|
+
export declare function currencyTypeEntries(armatureProposals: string, coinType: string, base: ProposalConfigInput): CurrencyTypeEntry[];
|
|
12
|
+
export declare function adoptCurrencyAction(pkgs: ArmaturePkgs, params: {
|
|
13
|
+
coinType: string;
|
|
14
|
+
treasuryCapId: string;
|
|
15
|
+
capabilityVaultId: string;
|
|
16
|
+
}): OuProposalAction;
|
|
17
|
+
export declare function mintCoinAction(pkgs: ArmaturePkgs, params: {
|
|
18
|
+
coinType: string;
|
|
19
|
+
treasuryCapId: string;
|
|
20
|
+
amount: bigint;
|
|
21
|
+
recipient?: string;
|
|
22
|
+
capabilityVaultId: string;
|
|
23
|
+
treasuryVaultId: string;
|
|
24
|
+
}): OuProposalAction;
|
|
25
|
+
export declare function mintAllowanceAction(pkgs: ArmaturePkgs, params: {
|
|
26
|
+
coinType: string;
|
|
27
|
+
treasuryCapId: string;
|
|
28
|
+
amount: bigint;
|
|
29
|
+
recipient?: string;
|
|
30
|
+
capabilityVaultId: string;
|
|
31
|
+
treasuryVaultId: string;
|
|
32
|
+
}): OuProposalAction;
|
|
33
|
+
export declare function burnCoinAction(pkgs: ArmaturePkgs, params: {
|
|
34
|
+
coinType: string;
|
|
35
|
+
treasuryCapId: string;
|
|
36
|
+
amount: bigint;
|
|
37
|
+
capabilityVaultId: string;
|
|
38
|
+
treasuryVaultId: string;
|
|
39
|
+
}): OuProposalAction;
|
|
40
|
+
export declare function returnCurrencyCapAction(pkgs: ArmaturePkgs, params: {
|
|
41
|
+
coinType: string;
|
|
42
|
+
treasuryCapId: string;
|
|
43
|
+
recipient: string;
|
|
44
|
+
capabilityVaultId: string;
|
|
45
|
+
}): OuProposalAction;
|
|
46
|
+
export declare function configureMintAllowanceAction(pkgs: ArmaturePkgs, params: {
|
|
47
|
+
coinType: string;
|
|
48
|
+
addMinters?: string[];
|
|
49
|
+
removeMinters?: string[];
|
|
50
|
+
maxPerCall?: bigint;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
}): OuProposalAction;
|
|
53
|
+
export declare function mintAllowanceBypassTx(args: {
|
|
54
|
+
armatureProposals: string;
|
|
55
|
+
coinType: string;
|
|
56
|
+
ouId: string;
|
|
57
|
+
capabilityVaultId: string;
|
|
58
|
+
treasuryVaultId: string;
|
|
59
|
+
emergencyFreezeId: string;
|
|
60
|
+
bypassCapId: string;
|
|
61
|
+
treasuryCapId: string;
|
|
62
|
+
amount: bigint;
|
|
63
|
+
recipient?: string;
|
|
64
|
+
}): Transaction;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { ArmaturePkgs } from './actions';
|
|
3
|
+
import { OuProposalAction } from './harness';
|
|
4
|
+
import { CompositeStep } from './plan';
|
|
5
|
+
import { OrgNode } from './types';
|
|
6
|
+
import { UpgradeBuild } from './upgrade';
|
|
7
|
+
type TxArg = ReturnType<Transaction['moveCall']>;
|
|
8
|
+
export interface PassedExecutionContext {
|
|
9
|
+
pkgs: ArmaturePkgs;
|
|
10
|
+
unit: {
|
|
11
|
+
daoId: string;
|
|
12
|
+
charterId?: string | null;
|
|
13
|
+
treasuryId?: string | null;
|
|
14
|
+
capabilityVaultId?: string | null;
|
|
15
|
+
emergencyFreezeId?: string | null;
|
|
16
|
+
};
|
|
17
|
+
nodes?: readonly OrgNode[];
|
|
18
|
+
payload?: Record<string, unknown>;
|
|
19
|
+
typeForDisplayKey?: (displayKey: string) => string | undefined;
|
|
20
|
+
capTypeOf?: (capId: string) => string | undefined;
|
|
21
|
+
freezeAdminCapId?: string;
|
|
22
|
+
treasuryCapId?: string;
|
|
23
|
+
upgrade?: UpgradeBuild;
|
|
24
|
+
}
|
|
25
|
+
export type PassedExecutor = {
|
|
26
|
+
execute: (tx: Transaction, ticket: TxArg, ownDaoId: string) => void;
|
|
27
|
+
} | {
|
|
28
|
+
missing: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function splitMoveType(type: string): {
|
|
31
|
+
pkg: string;
|
|
32
|
+
path: string;
|
|
33
|
+
args: string[];
|
|
34
|
+
};
|
|
35
|
+
export declare function executorForPayload(payloadMoveType: string, c: PassedExecutionContext): PassedExecutor;
|
|
36
|
+
export declare function defaultSlotType(pkgs: ArmaturePkgs, displayKey: string): string | null;
|
|
37
|
+
export declare function passedProposalAction(pkgs: ArmaturePkgs, args: {
|
|
38
|
+
typeKey: string;
|
|
39
|
+
payloadType?: string;
|
|
40
|
+
payload?: Record<string, unknown>;
|
|
41
|
+
charterId?: string;
|
|
42
|
+
} & Partial<Omit<PassedExecutionContext, 'pkgs' | 'payload'>>): OuProposalAction | null;
|
|
43
|
+
export declare function compositeStepExecutor(pkgs: ArmaturePkgs, typeKey: string, stepMoveType?: string, ctx?: Partial<Omit<PassedExecutionContext, 'pkgs'>>): CompositeStep | null;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { ClientWithCoreApi } from '@mysten/sui/client';
|
|
2
|
+
export interface ProposalConfig {
|
|
3
|
+
quorum: number;
|
|
4
|
+
approvalThreshold: number;
|
|
5
|
+
proposeThreshold: number;
|
|
6
|
+
expiryMs: number;
|
|
7
|
+
executionDelayMs: number;
|
|
8
|
+
cooldownMs: number;
|
|
9
|
+
composableAllowed: boolean;
|
|
10
|
+
permissions?: number;
|
|
11
|
+
borrowScope?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface TypeSlot {
|
|
14
|
+
typeName: string;
|
|
15
|
+
displayKey: string;
|
|
16
|
+
config: ProposalConfig;
|
|
17
|
+
lastExecutedMs: number | null;
|
|
18
|
+
}
|
|
19
|
+
export interface OuState {
|
|
20
|
+
status: 'active' | 'migrating';
|
|
21
|
+
successorOuId: string | null;
|
|
22
|
+
executionPaused: boolean;
|
|
23
|
+
controllerPaused: boolean;
|
|
24
|
+
controllerCapId: string | null;
|
|
25
|
+
memberCount: number;
|
|
26
|
+
rosterVersion: number;
|
|
27
|
+
membersTableId: string;
|
|
28
|
+
treasuryId: string;
|
|
29
|
+
capabilityVaultId: string;
|
|
30
|
+
charterId: string;
|
|
31
|
+
emergencyFreezeId: string;
|
|
32
|
+
encryptEpoch: number;
|
|
33
|
+
entries: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface FreezeState {
|
|
36
|
+
frozenTypes: Map<string, number>;
|
|
37
|
+
exemptTypes: string[];
|
|
38
|
+
maxFreezeDurationMs: number;
|
|
39
|
+
}
|
|
40
|
+
export interface DaoGovernance {
|
|
41
|
+
enabledTypes: Set<string>;
|
|
42
|
+
configs: Map<string, ProposalConfig>;
|
|
43
|
+
typeBindings: Map<string, string>;
|
|
44
|
+
slots?: TypeSlot[];
|
|
45
|
+
state?: OuState;
|
|
46
|
+
freeze?: FreezeState;
|
|
47
|
+
}
|
|
48
|
+
export declare const PERMISSIONS: {
|
|
49
|
+
readonly BOARD_ADD: number;
|
|
50
|
+
readonly BOARD_REMOVE: number;
|
|
51
|
+
readonly BOARD_SET: number;
|
|
52
|
+
readonly TYPE_ADMIN: number;
|
|
53
|
+
readonly PAUSE: number;
|
|
54
|
+
readonly MIGRATE: number;
|
|
55
|
+
readonly METADATA: number;
|
|
56
|
+
readonly TREASURY_WITHDRAW: number;
|
|
57
|
+
readonly VAULT_STORE: number;
|
|
58
|
+
readonly VAULT_BORROW: number;
|
|
59
|
+
readonly VAULT_EXTRACT: number;
|
|
60
|
+
readonly FREEZE: number;
|
|
61
|
+
};
|
|
62
|
+
export declare const HIGH_IMPACT_PERMISSIONS: number;
|
|
63
|
+
export declare const BYPASS_FORBIDDEN_PERMISSIONS: number;
|
|
64
|
+
export declare function permissionFloor(bits: number): number;
|
|
65
|
+
export declare function hasPermissions(mask: number, bits: number): boolean;
|
|
66
|
+
export declare function normalizeMoveType(type: string): string;
|
|
67
|
+
export declare function remapPackages(type: string, aliases: ReadonlyMap<string, string> | undefined): string;
|
|
68
|
+
export declare function slotForType(gov: DaoGovernance | undefined, moveType: string, opts?: {
|
|
69
|
+
displayKey?: string;
|
|
70
|
+
aliases?: ReadonlyMap<string, string>;
|
|
71
|
+
}): TypeSlot | undefined;
|
|
72
|
+
export declare function packageAliases(pairs: [current: string | undefined, original: string | undefined][]): Map<string, string>;
|
|
73
|
+
export declare const ProposalConfigBcs: import('@mysten/bcs').BcsStruct<{
|
|
74
|
+
quorum: import('@mysten/bcs').BcsType<number, number, "u16">;
|
|
75
|
+
approval_threshold: import('@mysten/bcs').BcsType<number, number, "u16">;
|
|
76
|
+
propose_threshold: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
77
|
+
expiry_ms: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
78
|
+
execution_delay_ms: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
79
|
+
cooldown_ms: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
80
|
+
composable_allowed: import('@mysten/bcs').BcsType<boolean, boolean, "bool">;
|
|
81
|
+
permissions: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
82
|
+
borrow_scope: import('@mysten/bcs').BcsType<{
|
|
83
|
+
name: string;
|
|
84
|
+
}[], Iterable<{
|
|
85
|
+
name: string;
|
|
86
|
+
}> & {
|
|
87
|
+
length: number;
|
|
88
|
+
}, string>;
|
|
89
|
+
}, string>;
|
|
90
|
+
export declare const TypeSlotFieldBcs: import('@mysten/bcs').BcsStruct<{
|
|
91
|
+
id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
92
|
+
name: import('@mysten/bcs').BcsStruct<{
|
|
93
|
+
name: import('@mysten/bcs').BcsStruct<{
|
|
94
|
+
name: import('@mysten/bcs').BcsType<string, string, "string">;
|
|
95
|
+
}, string>;
|
|
96
|
+
}, string>;
|
|
97
|
+
value: import('@mysten/bcs').BcsStruct<{
|
|
98
|
+
display_key: import('@mysten/bcs').BcsType<string, string, "string">;
|
|
99
|
+
config: import('@mysten/bcs').BcsStruct<{
|
|
100
|
+
quorum: import('@mysten/bcs').BcsType<number, number, "u16">;
|
|
101
|
+
approval_threshold: import('@mysten/bcs').BcsType<number, number, "u16">;
|
|
102
|
+
propose_threshold: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
103
|
+
expiry_ms: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
104
|
+
execution_delay_ms: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
105
|
+
cooldown_ms: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
106
|
+
composable_allowed: import('@mysten/bcs').BcsType<boolean, boolean, "bool">;
|
|
107
|
+
permissions: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
108
|
+
borrow_scope: import('@mysten/bcs').BcsType<{
|
|
109
|
+
name: string;
|
|
110
|
+
}[], Iterable<{
|
|
111
|
+
name: string;
|
|
112
|
+
}> & {
|
|
113
|
+
length: number;
|
|
114
|
+
}, string>;
|
|
115
|
+
}, string>;
|
|
116
|
+
last_executed_ms: import('@mysten/bcs').BcsType<string | null, string | number | bigint | null | undefined, "Option<u64>">;
|
|
117
|
+
}, string>;
|
|
118
|
+
}, string>;
|
|
119
|
+
export declare const OuBcs: import('@mysten/bcs').BcsStruct<{
|
|
120
|
+
id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
121
|
+
status: import('@mysten/bcs').BcsEnum<{
|
|
122
|
+
Active: null;
|
|
123
|
+
Migrating: import('@mysten/bcs').BcsStruct<{
|
|
124
|
+
successor_ou_id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
125
|
+
}, string>;
|
|
126
|
+
}, "OUStatus">;
|
|
127
|
+
governance: import('@mysten/bcs').BcsStruct<{
|
|
128
|
+
members: import('@mysten/bcs').BcsStruct<{
|
|
129
|
+
id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
130
|
+
size: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
131
|
+
}, string>;
|
|
132
|
+
member_count: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
133
|
+
roster_version: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
134
|
+
}, string>;
|
|
135
|
+
treasury_id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
136
|
+
capability_vault_id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
137
|
+
charter_id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
138
|
+
emergency_freeze_id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
139
|
+
execution_paused: import('@mysten/bcs').BcsType<boolean, boolean, "bool">;
|
|
140
|
+
controller_cap_id: import('@mysten/bcs').BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
|
|
141
|
+
controller_paused: import('@mysten/bcs').BcsType<boolean, boolean, "bool">;
|
|
142
|
+
encrypt_epoch: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
143
|
+
entries: import('@mysten/bcs').BcsType<string[], Iterable<string | Uint8Array<ArrayBufferLike>> & {
|
|
144
|
+
length: number;
|
|
145
|
+
}, string>;
|
|
146
|
+
}, string>;
|
|
147
|
+
export declare const EmergencyFreezeBcs: import('@mysten/bcs').BcsStruct<{
|
|
148
|
+
id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
149
|
+
ou_id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
150
|
+
frozen_types: import('@mysten/bcs').BcsStruct<{
|
|
151
|
+
contents: import('@mysten/bcs').BcsType<{
|
|
152
|
+
key: {
|
|
153
|
+
name: string;
|
|
154
|
+
};
|
|
155
|
+
value: string;
|
|
156
|
+
}[], Iterable<{
|
|
157
|
+
key: {
|
|
158
|
+
name: string;
|
|
159
|
+
};
|
|
160
|
+
value: string | number | bigint;
|
|
161
|
+
}> & {
|
|
162
|
+
length: number;
|
|
163
|
+
}, string>;
|
|
164
|
+
}, string>;
|
|
165
|
+
max_freeze_duration_ms: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
|
|
166
|
+
freeze_exempt_types: import('@mysten/bcs').BcsStruct<{
|
|
167
|
+
contents: import('@mysten/bcs').BcsType<{
|
|
168
|
+
name: string;
|
|
169
|
+
}[], Iterable<{
|
|
170
|
+
name: string;
|
|
171
|
+
}> & {
|
|
172
|
+
length: number;
|
|
173
|
+
}, string>;
|
|
174
|
+
}, string>;
|
|
175
|
+
}, string>;
|
|
176
|
+
export declare function configFromBcs(c: ReturnType<typeof ProposalConfigBcs.parse>): ProposalConfig;
|
|
177
|
+
export declare function parseTypeSlot(content: Uint8Array): TypeSlot;
|
|
178
|
+
export declare function parseOuState(content: Uint8Array): OuState;
|
|
179
|
+
export declare function parseFreezeState(content: Uint8Array): FreezeState;
|
|
180
|
+
export declare function governanceFromSlots(slots: TypeSlot[], extra?: {
|
|
181
|
+
state?: OuState;
|
|
182
|
+
freeze?: FreezeState;
|
|
183
|
+
}): DaoGovernance;
|
|
184
|
+
export declare function singleVoteExecutable(boardSize: number, config: ProposalConfig): boolean;
|
|
185
|
+
export declare function cooldownEndsAt(slot: {
|
|
186
|
+
config: ProposalConfig;
|
|
187
|
+
lastExecutedMs: number | null;
|
|
188
|
+
}): number | null;
|
|
189
|
+
export declare function fetchTypeSlots(suiClient: ClientWithCoreApi, ouId: string): Promise<TypeSlot[]>;
|
|
190
|
+
export declare function fetchOuState(suiClient: ClientWithCoreApi, ouId: string): Promise<OuState>;
|
|
191
|
+
export declare function fetchFreezeState(suiClient: ClientWithCoreApi, emergencyFreezeId: string): Promise<FreezeState>;
|
|
192
|
+
export declare function fetchDaoGovernance(suiClient: ClientWithCoreApi, daoId: string): Promise<DaoGovernance>;
|
|
193
|
+
export declare function fetchProposalConfig(suiClient: ClientWithCoreApi, daoId: string, typeKey: string): Promise<ProposalConfig | null>;
|
|
194
|
+
export declare function fetchIsBoardMember(suiClient: ClientWithCoreApi, membersTableId: string, address: string): Promise<boolean>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { DaoGovernance, OuState, ProposalConfig } from './governance';
|
|
3
|
+
import { OuExecContext } from './types';
|
|
4
|
+
type TxArg = ReturnType<Transaction['moveCall']>;
|
|
5
|
+
export type Strategy = 'own-execute' | 'control-execute' | 'own-propose' | 'control-propose';
|
|
6
|
+
export type BlockCode = 'not-member' | 'needs-slow-tier' | 'not-permitted' | 'missing-permissions' | 'paused' | 'frozen' | 'cooldown';
|
|
7
|
+
export interface OuCapabilities {
|
|
8
|
+
ownConfig: ProposalConfig | null;
|
|
9
|
+
controlConfig: ProposalConfig | null;
|
|
10
|
+
ownLastExecutedMs?: number | null;
|
|
11
|
+
controlLastExecutedMs?: number | null;
|
|
12
|
+
ownState?: OuState;
|
|
13
|
+
parentState?: OuState;
|
|
14
|
+
ownFrozenUntil?: number | null;
|
|
15
|
+
controlFrozenUntil?: number | null;
|
|
16
|
+
callerOnOwnBoard?: boolean;
|
|
17
|
+
callerOnParentBoard?: boolean;
|
|
18
|
+
nowMs?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface OuOwnAdapter {
|
|
21
|
+
typeKey: string;
|
|
22
|
+
payloadMoveType: string;
|
|
23
|
+
buildPayload: (tx: Transaction) => TxArg;
|
|
24
|
+
buildExecute: (tx: Transaction, ticket: TxArg, ownDaoId: string) => void;
|
|
25
|
+
requiredPermissions?: number;
|
|
26
|
+
requiredBorrowScope?: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface OuControlAdapter {
|
|
29
|
+
typeKey: string;
|
|
30
|
+
payloadMoveType: string;
|
|
31
|
+
buildPayload: (tx: Transaction, controlCapId: string) => TxArg;
|
|
32
|
+
buildExecute: (tx: Transaction, ticket: TxArg, capVaultId: string, childDaoId: string) => void;
|
|
33
|
+
requiredPermissions?: number;
|
|
34
|
+
requiredBorrowScope?: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface OuProposalAction {
|
|
37
|
+
kind: string;
|
|
38
|
+
own?: OuOwnAdapter;
|
|
39
|
+
control?: OuControlAdapter;
|
|
40
|
+
fallbackPolicy?: 'fall-back-to-proposal' | 'single-vote-only';
|
|
41
|
+
grantsPermissions?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface ExecutionPlan {
|
|
44
|
+
blocked: false;
|
|
45
|
+
strategy: Strategy;
|
|
46
|
+
immediate: boolean;
|
|
47
|
+
voterBoardSize: number;
|
|
48
|
+
readonly?: boolean;
|
|
49
|
+
reason: string;
|
|
50
|
+
buildTx: () => Transaction;
|
|
51
|
+
}
|
|
52
|
+
export interface BlockedPlan {
|
|
53
|
+
blocked: true;
|
|
54
|
+
code: BlockCode;
|
|
55
|
+
reason: string;
|
|
56
|
+
}
|
|
57
|
+
export type ResolvedPlan = ExecutionPlan | BlockedPlan;
|
|
58
|
+
export type StrategyDecision = {
|
|
59
|
+
blocked: false;
|
|
60
|
+
strategy: Strategy;
|
|
61
|
+
immediate: boolean;
|
|
62
|
+
voterBoardSize: number;
|
|
63
|
+
readonly?: boolean;
|
|
64
|
+
reason: string;
|
|
65
|
+
} | {
|
|
66
|
+
blocked: true;
|
|
67
|
+
code: BlockCode;
|
|
68
|
+
reason: string;
|
|
69
|
+
};
|
|
70
|
+
export type PathTier = 'immediate' | 'slow';
|
|
71
|
+
export interface PathCandidate {
|
|
72
|
+
strategy: Strategy;
|
|
73
|
+
tier: PathTier;
|
|
74
|
+
voterBoardSize: number;
|
|
75
|
+
viable: boolean;
|
|
76
|
+
applicable: boolean;
|
|
77
|
+
detail: string;
|
|
78
|
+
blocker?: BlockCode;
|
|
79
|
+
}
|
|
80
|
+
export declare function evaluatePaths(action: OuProposalAction, ctx: OuExecContext, caps: OuCapabilities, caller: string | undefined): PathCandidate[];
|
|
81
|
+
export declare function selectStrategy(action: OuProposalAction, ctx: OuExecContext, caps: OuCapabilities, caller: string | undefined): StrategyDecision;
|
|
82
|
+
export declare function capabilitiesFor(action: OuProposalAction, own: DaoGovernance | undefined, parent: DaoGovernance | undefined, opts?: {
|
|
83
|
+
aliases?: ReadonlyMap<string, string>;
|
|
84
|
+
nowMs?: number;
|
|
85
|
+
callerOnOwnBoard?: boolean;
|
|
86
|
+
callerOnParentBoard?: boolean;
|
|
87
|
+
}): OuCapabilities;
|
|
88
|
+
export declare const MAX_COMPOSITE_STEPS = 16;
|
|
89
|
+
export declare const COMPOSITE_TYPE_KEY = "Composite";
|
|
90
|
+
export type CompositeIneligibility = 'single-action' | 'too-many-steps' | 'composite-disabled' | 'step-not-composable' | 'grant-in-composite';
|
|
91
|
+
export interface CompositeEligibility {
|
|
92
|
+
eligible: boolean;
|
|
93
|
+
reason?: CompositeIneligibility;
|
|
94
|
+
}
|
|
95
|
+
export declare function canComposite(actions: OuProposalAction[], gov: DaoGovernance | undefined, aliases?: ReadonlyMap<string, string>): CompositeEligibility;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { ArmaturePkgs } from './actions';
|
|
3
|
+
import { OuProposalAction } from './harness';
|
|
4
|
+
import { ProposalConfigInput } from './transactions';
|
|
5
|
+
type TxArg = ReturnType<Transaction['moveCall']>;
|
|
6
|
+
export declare function pauseSubOuAction(pkgs: ArmaturePkgs): OuProposalAction;
|
|
7
|
+
export declare function unpauseSubOuAction(pkgs: ArmaturePkgs): OuProposalAction;
|
|
8
|
+
export declare function transferCapToSubOuAction(pkgs: ArmaturePkgs, params: {
|
|
9
|
+
subOuId: string;
|
|
10
|
+
subOuCapabilityVaultId: string;
|
|
11
|
+
capId: string;
|
|
12
|
+
capType: string;
|
|
13
|
+
}): OuProposalAction;
|
|
14
|
+
export declare function reclaimCapFromSubOuAction(pkgs: ArmaturePkgs, params: {
|
|
15
|
+
subOuId: string;
|
|
16
|
+
subOuCapabilityVaultId: string;
|
|
17
|
+
capId: string;
|
|
18
|
+
capType: string;
|
|
19
|
+
}): OuProposalAction;
|
|
20
|
+
export interface SpinOutConfigs {
|
|
21
|
+
spawnOu: ProposalConfigInput;
|
|
22
|
+
spinOutSubOu: ProposalConfigInput;
|
|
23
|
+
createSubOu: ProposalConfigInput;
|
|
24
|
+
}
|
|
25
|
+
export declare const HIERARCHY_TYPE_CONFIG: ProposalConfigInput;
|
|
26
|
+
export declare function spinOutSubOuAction(pkgs: ArmaturePkgs, params: {
|
|
27
|
+
subOuId: string;
|
|
28
|
+
subOuCapabilityVaultId: string;
|
|
29
|
+
freezeAdminCapId: string;
|
|
30
|
+
configs?: Partial<SpinOutConfigs>;
|
|
31
|
+
}): OuProposalAction;
|
|
32
|
+
export declare function createSubOuAction(pkgs: ArmaturePkgs, params: {
|
|
33
|
+
name: string;
|
|
34
|
+
board: string[];
|
|
35
|
+
metadataUri: string;
|
|
36
|
+
capabilityVaultId: string;
|
|
37
|
+
}): OuProposalAction;
|
|
38
|
+
export declare function spawnOuAction(pkgs: ArmaturePkgs, params: {
|
|
39
|
+
board: string[];
|
|
40
|
+
name: string;
|
|
41
|
+
metadataUri: string;
|
|
42
|
+
}): OuProposalAction;
|
|
43
|
+
export declare function transferAssetsAction(pkgs: ArmaturePkgs, params: {
|
|
44
|
+
targetOuId: string;
|
|
45
|
+
targetTreasuryId: string;
|
|
46
|
+
targetCapabilityVaultId: string;
|
|
47
|
+
coinTypes: string[];
|
|
48
|
+
caps: {
|
|
49
|
+
id: string;
|
|
50
|
+
type: string;
|
|
51
|
+
}[];
|
|
52
|
+
treasuryVaultId: string;
|
|
53
|
+
capabilityVaultId: string;
|
|
54
|
+
}): OuProposalAction;
|
|
55
|
+
export declare function appendTransferAssets(tx: Transaction, armature: string, ticket: TxArg, params: {
|
|
56
|
+
targetTreasuryId: string;
|
|
57
|
+
targetCapabilityVaultId: string;
|
|
58
|
+
coinTypes: string[];
|
|
59
|
+
caps: {
|
|
60
|
+
id: string;
|
|
61
|
+
type: string;
|
|
62
|
+
}[];
|
|
63
|
+
treasuryVaultId: string;
|
|
64
|
+
capabilityVaultId: string;
|
|
65
|
+
}): void;
|
|
66
|
+
export declare function transferFreezeAdminAction(pkgs: ArmaturePkgs, params: {
|
|
67
|
+
newAdmin: string;
|
|
68
|
+
freezeAdminCapId: string;
|
|
69
|
+
emergencyFreezeId: string;
|
|
70
|
+
}): OuProposalAction;
|
|
71
|
+
export declare function unfreezeProposalTypeAction(pkgs: ArmaturePkgs, params: {
|
|
72
|
+
moveType: string;
|
|
73
|
+
emergencyFreezeId: string;
|
|
74
|
+
}): OuProposalAction;
|
|
75
|
+
export declare function updateFreezeConfigAction(pkgs: ArmaturePkgs, params: {
|
|
76
|
+
maxFreezeDurationMs: number;
|
|
77
|
+
emergencyFreezeId: string;
|
|
78
|
+
}): OuProposalAction;
|
|
79
|
+
export declare function updateFreezeExemptTypesAction(pkgs: ArmaturePkgs, params: {
|
|
80
|
+
add?: string[];
|
|
81
|
+
remove?: string[];
|
|
82
|
+
emergencyFreezeId: string;
|
|
83
|
+
}): OuProposalAction;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { NormalizedExecution } from '../execute';
|
|
3
|
+
import { OuCapabilities, OuProposalAction, ResolvedPlan, Strategy } from './harness';
|
|
4
|
+
import { OuExecContext } from './types';
|
|
5
|
+
type TxArg = ReturnType<Transaction['moveCall']>;
|
|
6
|
+
export interface PlanOptions {
|
|
7
|
+
readonly?: boolean;
|
|
8
|
+
metadataIpfs?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function appendPlanActions(tx: Transaction, strategy: Strategy, actions: OuProposalAction[], ctx: OuExecContext, armature: string, opts?: PlanOptions): void;
|
|
11
|
+
export declare function buildPlanTx(strategy: Strategy, action: OuProposalAction, ctx: OuExecContext, armature: string, opts?: PlanOptions): Transaction;
|
|
12
|
+
export declare function buildBatchPlanTx(strategy: Strategy, actions: OuProposalAction[], ctx: OuExecContext, armature: string, opts?: PlanOptions): Transaction;
|
|
13
|
+
export declare function buildCompositeSubmitTx(actions: OuProposalAction[], ctx: OuExecContext, armature: string, opts?: PlanOptions): Transaction;
|
|
14
|
+
export declare function buildExecutePassedTx(args: {
|
|
15
|
+
action: OuProposalAction;
|
|
16
|
+
armature: string;
|
|
17
|
+
daoId: string;
|
|
18
|
+
proposalId: string;
|
|
19
|
+
emergencyFreezeId: string;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
}): Transaction;
|
|
22
|
+
export interface CompositeStep {
|
|
23
|
+
payloadMoveType: string;
|
|
24
|
+
buildExecute: (tx: Transaction, ticket: TxArg, ownDaoId: string) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function buildExecuteCompositeTx(args: {
|
|
27
|
+
armature: string;
|
|
28
|
+
daoId: string;
|
|
29
|
+
proposalId: string;
|
|
30
|
+
emergencyFreezeId: string;
|
|
31
|
+
frameId: string;
|
|
32
|
+
steps: CompositeStep[];
|
|
33
|
+
deleteFrame?: boolean;
|
|
34
|
+
}): Transaction;
|
|
35
|
+
export declare function extractCreatedProposalId(res: NormalizedExecution): string | undefined;
|
|
36
|
+
export declare function resolveExecutionPlan(action: OuProposalAction, ctx: OuExecContext, caps: OuCapabilities, caller: string | undefined, armature: string, opts?: {
|
|
37
|
+
metadataIpfs?: string | null;
|
|
38
|
+
}): ResolvedPlan;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ClientWithCoreApi } from '@mysten/sui/client';
|
|
2
|
+
import { ProposalConfig } from './governance';
|
|
3
|
+
export declare function asRecord(v: unknown): Record<string, unknown> | undefined;
|
|
4
|
+
export declare function readTypeName(v: unknown): string | undefined;
|
|
5
|
+
export declare function parseProposalConfigJson(v: unknown): ProposalConfig | null;
|
|
6
|
+
export declare function payloadTypeOf(objectType: string): string | undefined;
|
|
7
|
+
export interface LiveProposal {
|
|
8
|
+
proposalId: string;
|
|
9
|
+
ouId: string;
|
|
10
|
+
payloadType: string;
|
|
11
|
+
typeKey: string;
|
|
12
|
+
proposer: string;
|
|
13
|
+
metadataIpfs: string | null;
|
|
14
|
+
payload: Record<string, unknown>;
|
|
15
|
+
snapshotVersion: number;
|
|
16
|
+
totalSnapshotWeight: number;
|
|
17
|
+
votesCast: Record<string, boolean>;
|
|
18
|
+
yesWeight: number;
|
|
19
|
+
noWeight: number;
|
|
20
|
+
config: ProposalConfig;
|
|
21
|
+
createdAtMs: number;
|
|
22
|
+
passedAtMs: number | null;
|
|
23
|
+
status: 'active' | 'passed';
|
|
24
|
+
votingDeadlineMs: number;
|
|
25
|
+
executableFromMs: number | null;
|
|
26
|
+
executionDeadlineMs: number | null;
|
|
27
|
+
}
|
|
28
|
+
export declare function parseLiveProposal(proposalId: string, objectType: string, json: Record<string, unknown>): LiveProposal;
|
|
29
|
+
export declare function fetchProposal(suiClient: ClientWithCoreApi, proposalId: string): Promise<LiveProposal | null>;
|
|
30
|
+
export declare function isDeletable(p: LiveProposal, nowMs?: number): boolean;
|
|
31
|
+
export declare function isExecutable(p: LiveProposal, nowMs?: number): boolean;
|
|
32
|
+
export interface CapabilityVaultContents {
|
|
33
|
+
vaultId: string;
|
|
34
|
+
ouId: string;
|
|
35
|
+
capIds: string[];
|
|
36
|
+
byType: Map<string, string[]>;
|
|
37
|
+
}
|
|
38
|
+
export declare function parseCapabilityVault(content: Uint8Array): CapabilityVaultContents;
|
|
39
|
+
export declare function fetchCapabilityVault(suiClient: ClientWithCoreApi, vaultId: string): Promise<CapabilityVaultContents>;
|
|
40
|
+
export declare function capTypeOf(vault: CapabilityVaultContents, capId: string): string | undefined;
|
|
41
|
+
export interface EncryptedEntry {
|
|
42
|
+
entryId: string;
|
|
43
|
+
ouId: string;
|
|
44
|
+
location: string;
|
|
45
|
+
description: string;
|
|
46
|
+
createdBy: string;
|
|
47
|
+
encryptEpoch: number;
|
|
48
|
+
stale: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare function fetchEncryptedEntries(suiClient: ClientWithCoreApi, entryIds: string[], currentEpoch: number): Promise<EncryptedEntry[]>;
|
|
51
|
+
export declare function fetchFrameStepPayload(suiClient: ClientWithCoreApi, frameId: string, index: number): Promise<Record<string, unknown> | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AccessibleKeyspace, HubDaoVault, Org, OrgDirectoryPage, OrgDirectoryParams, OrgSearchParams, OrgSearchResult, ProposalSummary } from './types';
|
|
2
|
+
export declare const MAX_BATCH_IDS = 200;
|
|
3
|
+
export declare class OrgQueries {
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
private readonly apiKey;
|
|
6
|
+
constructor(baseUrl: string, apiKey: string);
|
|
7
|
+
private fetchJson;
|
|
8
|
+
get(orgId: string): Promise<Org>;
|
|
9
|
+
batch(orgIds: string[]): Promise<Org[]>;
|
|
10
|
+
directory(params?: OrgDirectoryParams): Promise<OrgDirectoryPage>;
|
|
11
|
+
forPlayer(address: string): Promise<Org[]>;
|
|
12
|
+
search(q: string, params?: OrgSearchParams): Promise<OrgSearchResult[]>;
|
|
13
|
+
proposals(orgId: string): Promise<ProposalSummary[]>;
|
|
14
|
+
accessibleKeyspaces(address: string, role?: 'grant' | 'read' | 'write'): Promise<AccessibleKeyspace[]>;
|
|
15
|
+
vaultsAtHub(hubId: string): Promise<HubDaoVault[]>;
|
|
16
|
+
}
|