fortis-multisig-client 0.1.0 → 0.1.2
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/dist/generated/accounts/index.d.ts +10 -0
- package/dist/generated/accounts/index.js +10 -0
- package/dist/generated/accounts/multisig.d.ts +51 -0
- package/dist/generated/accounts/multisig.js +52 -0
- package/dist/generated/accounts/proposal.d.ts +49 -0
- package/dist/generated/accounts/proposal.js +54 -0
- package/dist/generated/accounts/vaultTransaction.d.ts +66 -0
- package/dist/generated/accounts/vaultTransaction.js +61 -0
- package/dist/generated/index.d.ts +11 -0
- package/dist/generated/index.js +11 -0
- package/dist/generated/instructions/index.d.ts +12 -0
- package/dist/generated/instructions/index.js +12 -0
- package/dist/generated/instructions/multisigCreate.d.ts +65 -0
- package/dist/generated/instructions/multisigCreate.js +80 -0
- package/dist/generated/instructions/proposalAccountsClose.d.ts +54 -0
- package/dist/generated/instructions/proposalAccountsClose.js +76 -0
- package/dist/generated/instructions/proposalApprove.d.ts +47 -0
- package/dist/generated/instructions/proposalApprove.js +74 -0
- package/dist/generated/instructions/proposalCreate.d.ts +57 -0
- package/dist/generated/instructions/proposalCreate.js +80 -0
- package/dist/generated/instructions/proposalExecute.d.ts +49 -0
- package/dist/generated/instructions/proposalExecute.js +70 -0
- package/dist/generated/programs/fortisMultisig.d.ts +36 -0
- package/dist/generated/programs/fortisMultisig.js +42 -0
- package/dist/generated/programs/index.d.ts +8 -0
- package/dist/generated/programs/index.js +8 -0
- package/dist/generated/shared/index.d.ts +49 -0
- package/dist/generated/shared/index.js +86 -0
- package/dist/generated/types/compiledInstruction.d.ts +20 -0
- package/dist/generated/types/compiledInstruction.js +31 -0
- package/dist/generated/types/index.d.ts +13 -0
- package/dist/generated/types/index.js +13 -0
- package/dist/generated/types/messageAddressTableLookup.d.ts +24 -0
- package/dist/generated/types/messageAddressTableLookup.js +37 -0
- package/dist/generated/types/multisigCreateArgs.d.ts +33 -0
- package/dist/generated/types/multisigCreateArgs.js +25 -0
- package/dist/generated/types/proposalApproveArgs.d.ts +13 -0
- package/dist/generated/types/proposalApproveArgs.js +17 -0
- package/dist/generated/types/proposalCreateArgs.d.ts +25 -0
- package/dist/generated/types/proposalCreateArgs.js +31 -0
- package/dist/generated/types/vaultTransactionMessage.d.ts +68 -0
- package/dist/generated/types/vaultTransactionMessage.js +38 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/instructions/index.d.ts +12 -0
- package/dist/instructions/index.js +12 -0
- package/dist/instructions/multisigCreate.d.ts +10 -0
- package/dist/instructions/multisigCreate.js +26 -0
- package/dist/instructions/proposalAccountsClose.d.ts +6 -0
- package/dist/instructions/proposalAccountsClose.js +19 -0
- package/dist/instructions/proposalApprove.d.ts +6 -0
- package/dist/instructions/proposalApprove.js +15 -0
- package/dist/instructions/proposalCreate.d.ts +10 -0
- package/dist/instructions/proposalCreate.js +27 -0
- package/dist/instructions/proposalExecute.d.ts +10 -0
- package/dist/instructions/proposalExecute.js +39 -0
- package/dist/pda.d.ts +27 -0
- package/dist/pda.js +41 -0
- package/dist/utils/compileToWrappedMessageV0.d.ts +11 -0
- package/dist/utils/compileToWrappedMessageV0.js +29 -0
- package/dist/utils/compiled-keys.d.ts +27 -0
- package/dist/utils/compiled-keys.js +112 -0
- package/dist/utils.d.ts +28 -0
- package/dist/utils.js +184 -0
- package/package.json +2 -2
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { AccountRole, isProgramDerivedAddress, isTransactionSigner as kitIsTransactionSigner, upgradeRoleToSigner, } from '@solana/kit';
|
|
9
|
+
/**
|
|
10
|
+
* Asserts that the given value is not null or undefined.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export function expectSome(value) {
|
|
14
|
+
if (value === null || value === undefined) {
|
|
15
|
+
throw new Error('Expected a value but received null or undefined.');
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Asserts that the given value is a PublicKey.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export function expectAddress(value) {
|
|
24
|
+
if (!value) {
|
|
25
|
+
throw new Error('Expected a Address.');
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === 'object' && 'address' in value) {
|
|
28
|
+
return value.address;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
return value[0];
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Asserts that the given value is a PDA.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export function expectProgramDerivedAddress(value) {
|
|
40
|
+
if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {
|
|
41
|
+
throw new Error('Expected a ProgramDerivedAddress.');
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Asserts that the given value is a TransactionSigner.
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export function expectTransactionSigner(value) {
|
|
50
|
+
if (!value || !isTransactionSigner(value)) {
|
|
51
|
+
throw new Error('Expected a TransactionSigner.');
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get account metas and signers from resolved accounts.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
60
|
+
return (account) => {
|
|
61
|
+
if (!account.value) {
|
|
62
|
+
if (optionalAccountStrategy === 'omitted')
|
|
63
|
+
return;
|
|
64
|
+
return Object.freeze({
|
|
65
|
+
address: programAddress,
|
|
66
|
+
role: AccountRole.READONLY,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const writableRole = account.isWritable
|
|
70
|
+
? AccountRole.WRITABLE
|
|
71
|
+
: AccountRole.READONLY;
|
|
72
|
+
return Object.freeze({
|
|
73
|
+
address: expectAddress(account.value),
|
|
74
|
+
role: isTransactionSigner(account.value)
|
|
75
|
+
? upgradeRoleToSigner(writableRole)
|
|
76
|
+
: writableRole,
|
|
77
|
+
...(isTransactionSigner(account.value) ? { signer: account.value } : {}),
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export function isTransactionSigner(value) {
|
|
82
|
+
return (!!value &&
|
|
83
|
+
typeof value === 'object' &&
|
|
84
|
+
'address' in value &&
|
|
85
|
+
kitIsTransactionSigner(value));
|
|
86
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Codec, type Decoder, type Encoder, type ReadonlyUint8Array } from '@solana/kit';
|
|
9
|
+
/** Concise serialization schema for instructions that make up a transaction. */
|
|
10
|
+
export type CompiledInstruction = {
|
|
11
|
+
programIdIndex: number;
|
|
12
|
+
/** Indices into the tx's `account_keys` list indicating which accounts to pass to the instruction. */
|
|
13
|
+
accountIndexes: ReadonlyUint8Array;
|
|
14
|
+
/** Instruction data. */
|
|
15
|
+
data: ReadonlyUint8Array;
|
|
16
|
+
};
|
|
17
|
+
export type CompiledInstructionArgs = CompiledInstruction;
|
|
18
|
+
export declare function getCompiledInstructionEncoder(): Encoder<CompiledInstructionArgs>;
|
|
19
|
+
export declare function getCompiledInstructionDecoder(): Decoder<CompiledInstruction>;
|
|
20
|
+
export declare function getCompiledInstructionCodec(): Codec<CompiledInstructionArgs, CompiledInstruction>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { addDecoderSizePrefix, addEncoderSizePrefix, combineCodec, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU8Decoder, getU8Encoder, } from '@solana/kit';
|
|
9
|
+
export function getCompiledInstructionEncoder() {
|
|
10
|
+
return getStructEncoder([
|
|
11
|
+
['programIdIndex', getU8Encoder()],
|
|
12
|
+
[
|
|
13
|
+
'accountIndexes',
|
|
14
|
+
addEncoderSizePrefix(getBytesEncoder(), getU32Encoder()),
|
|
15
|
+
],
|
|
16
|
+
['data', addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
export function getCompiledInstructionDecoder() {
|
|
20
|
+
return getStructDecoder([
|
|
21
|
+
['programIdIndex', getU8Decoder()],
|
|
22
|
+
[
|
|
23
|
+
'accountIndexes',
|
|
24
|
+
addDecoderSizePrefix(getBytesDecoder(), getU32Decoder()),
|
|
25
|
+
],
|
|
26
|
+
['data', addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
export function getCompiledInstructionCodec() {
|
|
30
|
+
return combineCodec(getCompiledInstructionEncoder(), getCompiledInstructionDecoder());
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
export * from './compiledInstruction';
|
|
9
|
+
export * from './messageAddressTableLookup';
|
|
10
|
+
export * from './multisigCreateArgs';
|
|
11
|
+
export * from './proposalApproveArgs';
|
|
12
|
+
export * from './proposalCreateArgs';
|
|
13
|
+
export * from './vaultTransactionMessage';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
export * from './compiledInstruction';
|
|
9
|
+
export * from './messageAddressTableLookup';
|
|
10
|
+
export * from './multisigCreateArgs';
|
|
11
|
+
export * from './proposalApproveArgs';
|
|
12
|
+
export * from './proposalCreateArgs';
|
|
13
|
+
export * from './vaultTransactionMessage';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder, type ReadonlyUint8Array } from '@solana/kit';
|
|
9
|
+
/**
|
|
10
|
+
* Address table lookups describe an on-chain address lookup table to use
|
|
11
|
+
* for loading more readonly and writable accounts into a transaction.
|
|
12
|
+
*/
|
|
13
|
+
export type MessageAddressTableLookup = {
|
|
14
|
+
/** Address lookup table account key. */
|
|
15
|
+
accountKey: Address;
|
|
16
|
+
/** List of indexes used to load writable accounts. */
|
|
17
|
+
writableIndexes: ReadonlyUint8Array;
|
|
18
|
+
/** List of indexes used to load readonly accounts. */
|
|
19
|
+
readonlyIndexes: ReadonlyUint8Array;
|
|
20
|
+
};
|
|
21
|
+
export type MessageAddressTableLookupArgs = MessageAddressTableLookup;
|
|
22
|
+
export declare function getMessageAddressTableLookupEncoder(): Encoder<MessageAddressTableLookupArgs>;
|
|
23
|
+
export declare function getMessageAddressTableLookupDecoder(): Decoder<MessageAddressTableLookup>;
|
|
24
|
+
export declare function getMessageAddressTableLookupCodec(): Codec<MessageAddressTableLookupArgs, MessageAddressTableLookup>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { addDecoderSizePrefix, addEncoderSizePrefix, combineCodec, getAddressDecoder, getAddressEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, } from '@solana/kit';
|
|
9
|
+
export function getMessageAddressTableLookupEncoder() {
|
|
10
|
+
return getStructEncoder([
|
|
11
|
+
['accountKey', getAddressEncoder()],
|
|
12
|
+
[
|
|
13
|
+
'writableIndexes',
|
|
14
|
+
addEncoderSizePrefix(getBytesEncoder(), getU32Encoder()),
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
'readonlyIndexes',
|
|
18
|
+
addEncoderSizePrefix(getBytesEncoder(), getU32Encoder()),
|
|
19
|
+
],
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
export function getMessageAddressTableLookupDecoder() {
|
|
23
|
+
return getStructDecoder([
|
|
24
|
+
['accountKey', getAddressDecoder()],
|
|
25
|
+
[
|
|
26
|
+
'writableIndexes',
|
|
27
|
+
addDecoderSizePrefix(getBytesDecoder(), getU32Decoder()),
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
'readonlyIndexes',
|
|
31
|
+
addDecoderSizePrefix(getBytesDecoder(), getU32Decoder()),
|
|
32
|
+
],
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
export function getMessageAddressTableLookupCodec() {
|
|
36
|
+
return combineCodec(getMessageAddressTableLookupEncoder(), getMessageAddressTableLookupDecoder());
|
|
37
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder, type Option, type OptionOrNullable } from '@solana/kit';
|
|
9
|
+
export type MultisigCreateArgs = {
|
|
10
|
+
/** The number of signatures required to execute a transaction. */
|
|
11
|
+
threshold: number;
|
|
12
|
+
/**
|
|
13
|
+
* The address where the rent for the accounts related to executed, rejected, or cancelled
|
|
14
|
+
* transactions can be reclaimed. If set to `None`, the rent reclamation feature is turned off.
|
|
15
|
+
*/
|
|
16
|
+
rentCollector: Option<Address>;
|
|
17
|
+
/** The members of the multisig. */
|
|
18
|
+
members: Array<Address>;
|
|
19
|
+
};
|
|
20
|
+
export type MultisigCreateArgsArgs = {
|
|
21
|
+
/** The number of signatures required to execute a transaction. */
|
|
22
|
+
threshold: number;
|
|
23
|
+
/**
|
|
24
|
+
* The address where the rent for the accounts related to executed, rejected, or cancelled
|
|
25
|
+
* transactions can be reclaimed. If set to `None`, the rent reclamation feature is turned off.
|
|
26
|
+
*/
|
|
27
|
+
rentCollector: OptionOrNullable<Address>;
|
|
28
|
+
/** The members of the multisig. */
|
|
29
|
+
members: Array<Address>;
|
|
30
|
+
};
|
|
31
|
+
export declare function getMultisigCreateArgsEncoder(): Encoder<MultisigCreateArgsArgs>;
|
|
32
|
+
export declare function getMultisigCreateArgsDecoder(): Decoder<MultisigCreateArgs>;
|
|
33
|
+
export declare function getMultisigCreateArgsCodec(): Codec<MultisigCreateArgsArgs, MultisigCreateArgs>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { combineCodec, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getOptionDecoder, getOptionEncoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, } from '@solana/kit';
|
|
9
|
+
export function getMultisigCreateArgsEncoder() {
|
|
10
|
+
return getStructEncoder([
|
|
11
|
+
['threshold', getU16Encoder()],
|
|
12
|
+
['rentCollector', getOptionEncoder(getAddressEncoder())],
|
|
13
|
+
['members', getArrayEncoder(getAddressEncoder())],
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
export function getMultisigCreateArgsDecoder() {
|
|
17
|
+
return getStructDecoder([
|
|
18
|
+
['threshold', getU16Decoder()],
|
|
19
|
+
['rentCollector', getOptionDecoder(getAddressDecoder())],
|
|
20
|
+
['members', getArrayDecoder(getAddressDecoder())],
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
export function getMultisigCreateArgsCodec() {
|
|
24
|
+
return combineCodec(getMultisigCreateArgsEncoder(), getMultisigCreateArgsDecoder());
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';
|
|
9
|
+
export type ProposalApproveArgs = {};
|
|
10
|
+
export type ProposalApproveArgsArgs = ProposalApproveArgs;
|
|
11
|
+
export declare function getProposalApproveArgsEncoder(): FixedSizeEncoder<ProposalApproveArgsArgs>;
|
|
12
|
+
export declare function getProposalApproveArgsDecoder(): FixedSizeDecoder<ProposalApproveArgs>;
|
|
13
|
+
export declare function getProposalApproveArgsCodec(): FixedSizeCodec<ProposalApproveArgsArgs, ProposalApproveArgs>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { combineCodec, getStructDecoder, getStructEncoder, } from '@solana/kit';
|
|
9
|
+
export function getProposalApproveArgsEncoder() {
|
|
10
|
+
return getStructEncoder([]);
|
|
11
|
+
}
|
|
12
|
+
export function getProposalApproveArgsDecoder() {
|
|
13
|
+
return getStructDecoder([]);
|
|
14
|
+
}
|
|
15
|
+
export function getProposalApproveArgsCodec() {
|
|
16
|
+
return combineCodec(getProposalApproveArgsEncoder(), getProposalApproveArgsDecoder());
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Codec, type Decoder, type Encoder, type ReadonlyUint8Array } from '@solana/kit';
|
|
9
|
+
export type ProposalCreateArgs = {
|
|
10
|
+
/** Number of ephemeral signing PDAs required by the transaction. */
|
|
11
|
+
ephemeralSigners: number;
|
|
12
|
+
/** Deadline to Vote. */
|
|
13
|
+
votingDeadline: bigint;
|
|
14
|
+
transactionMessage: ReadonlyUint8Array;
|
|
15
|
+
};
|
|
16
|
+
export type ProposalCreateArgsArgs = {
|
|
17
|
+
/** Number of ephemeral signing PDAs required by the transaction. */
|
|
18
|
+
ephemeralSigners: number;
|
|
19
|
+
/** Deadline to Vote. */
|
|
20
|
+
votingDeadline: number | bigint;
|
|
21
|
+
transactionMessage: ReadonlyUint8Array;
|
|
22
|
+
};
|
|
23
|
+
export declare function getProposalCreateArgsEncoder(): Encoder<ProposalCreateArgsArgs>;
|
|
24
|
+
export declare function getProposalCreateArgsDecoder(): Decoder<ProposalCreateArgs>;
|
|
25
|
+
export declare function getProposalCreateArgsCodec(): Codec<ProposalCreateArgsArgs, ProposalCreateArgs>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { addDecoderSizePrefix, addEncoderSizePrefix, combineCodec, getBytesDecoder, getBytesEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU8Decoder, getU8Encoder, } from '@solana/kit';
|
|
9
|
+
export function getProposalCreateArgsEncoder() {
|
|
10
|
+
return getStructEncoder([
|
|
11
|
+
['ephemeralSigners', getU8Encoder()],
|
|
12
|
+
['votingDeadline', getI64Encoder()],
|
|
13
|
+
[
|
|
14
|
+
'transactionMessage',
|
|
15
|
+
addEncoderSizePrefix(getBytesEncoder(), getU32Encoder()),
|
|
16
|
+
],
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
export function getProposalCreateArgsDecoder() {
|
|
20
|
+
return getStructDecoder([
|
|
21
|
+
['ephemeralSigners', getU8Decoder()],
|
|
22
|
+
['votingDeadline', getI64Decoder()],
|
|
23
|
+
[
|
|
24
|
+
'transactionMessage',
|
|
25
|
+
addDecoderSizePrefix(getBytesDecoder(), getU32Decoder()),
|
|
26
|
+
],
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
export function getProposalCreateArgsCodec() {
|
|
30
|
+
return combineCodec(getProposalCreateArgsEncoder(), getProposalCreateArgsDecoder());
|
|
31
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { type Address, type Codec, type Decoder, type Encoder } from '@solana/kit';
|
|
9
|
+
import { type CompiledInstruction, type CompiledInstructionArgs, type MessageAddressTableLookup, type MessageAddressTableLookupArgs } from '.';
|
|
10
|
+
export type VaultTransactionMessage = {
|
|
11
|
+
/** The number of signer pubkeys in the account_keys vec. */
|
|
12
|
+
numSigners: number;
|
|
13
|
+
/** The number of writable signer pubkeys in the account_keys vec. */
|
|
14
|
+
numWritableSigners: number;
|
|
15
|
+
/** The number of writable non-signer pubkeys in the account_keys vec. */
|
|
16
|
+
numWritableNonSigners: number;
|
|
17
|
+
/**
|
|
18
|
+
* Unique account pubkeys (including program IDs) required for execution of the tx.
|
|
19
|
+
* The signer pubkeys appear at the beginning of the vec, with writable pubkeys first, and read-only pubkeys following.
|
|
20
|
+
* The non-signer pubkeys follow with writable pubkeys first and read-only ones following.
|
|
21
|
+
* Program IDs are also stored at the end of the vec along with other non-signer non-writable pubkeys:
|
|
22
|
+
*
|
|
23
|
+
* ```plaintext
|
|
24
|
+
* [pubkey1, pubkey2, pubkey3, pubkey4, pubkey5, pubkey6, pubkey7, pubkey8]
|
|
25
|
+
* |---writable---| |---readonly---| |---writable---| |---readonly---|
|
|
26
|
+
* |------------signers-------------| |----------non-singers-----------|
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
accountKeys: Array<Address>;
|
|
30
|
+
/**
|
|
31
|
+
* List of address table lookups used to load additional accounts
|
|
32
|
+
* for this transaction.
|
|
33
|
+
*/
|
|
34
|
+
addressTableLookups: Array<MessageAddressTableLookup>;
|
|
35
|
+
/** List of instructions making up the tx. */
|
|
36
|
+
instructions: Array<CompiledInstruction>;
|
|
37
|
+
};
|
|
38
|
+
export type VaultTransactionMessageArgs = {
|
|
39
|
+
/** The number of signer pubkeys in the account_keys vec. */
|
|
40
|
+
numSigners: number;
|
|
41
|
+
/** The number of writable signer pubkeys in the account_keys vec. */
|
|
42
|
+
numWritableSigners: number;
|
|
43
|
+
/** The number of writable non-signer pubkeys in the account_keys vec. */
|
|
44
|
+
numWritableNonSigners: number;
|
|
45
|
+
/**
|
|
46
|
+
* Unique account pubkeys (including program IDs) required for execution of the tx.
|
|
47
|
+
* The signer pubkeys appear at the beginning of the vec, with writable pubkeys first, and read-only pubkeys following.
|
|
48
|
+
* The non-signer pubkeys follow with writable pubkeys first and read-only ones following.
|
|
49
|
+
* Program IDs are also stored at the end of the vec along with other non-signer non-writable pubkeys:
|
|
50
|
+
*
|
|
51
|
+
* ```plaintext
|
|
52
|
+
* [pubkey1, pubkey2, pubkey3, pubkey4, pubkey5, pubkey6, pubkey7, pubkey8]
|
|
53
|
+
* |---writable---| |---readonly---| |---writable---| |---readonly---|
|
|
54
|
+
* |------------signers-------------| |----------non-singers-----------|
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
accountKeys: Array<Address>;
|
|
58
|
+
/**
|
|
59
|
+
* List of address table lookups used to load additional accounts
|
|
60
|
+
* for this transaction.
|
|
61
|
+
*/
|
|
62
|
+
addressTableLookups: Array<MessageAddressTableLookupArgs>;
|
|
63
|
+
/** List of instructions making up the tx. */
|
|
64
|
+
instructions: Array<CompiledInstructionArgs>;
|
|
65
|
+
};
|
|
66
|
+
export declare function getVaultTransactionMessageEncoder(): Encoder<VaultTransactionMessageArgs>;
|
|
67
|
+
export declare function getVaultTransactionMessageDecoder(): Decoder<VaultTransactionMessage>;
|
|
68
|
+
export declare function getVaultTransactionMessageCodec(): Codec<VaultTransactionMessageArgs, VaultTransactionMessage>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
import { combineCodec, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getStructDecoder, getStructEncoder, getU8Decoder, getU8Encoder, } from '@solana/kit';
|
|
9
|
+
import { getCompiledInstructionDecoder, getCompiledInstructionEncoder, getMessageAddressTableLookupDecoder, getMessageAddressTableLookupEncoder, } from '.';
|
|
10
|
+
export function getVaultTransactionMessageEncoder() {
|
|
11
|
+
return getStructEncoder([
|
|
12
|
+
['numSigners', getU8Encoder()],
|
|
13
|
+
['numWritableSigners', getU8Encoder()],
|
|
14
|
+
['numWritableNonSigners', getU8Encoder()],
|
|
15
|
+
['accountKeys', getArrayEncoder(getAddressEncoder())],
|
|
16
|
+
[
|
|
17
|
+
'addressTableLookups',
|
|
18
|
+
getArrayEncoder(getMessageAddressTableLookupEncoder()),
|
|
19
|
+
],
|
|
20
|
+
['instructions', getArrayEncoder(getCompiledInstructionEncoder())],
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
export function getVaultTransactionMessageDecoder() {
|
|
24
|
+
return getStructDecoder([
|
|
25
|
+
['numSigners', getU8Decoder()],
|
|
26
|
+
['numWritableSigners', getU8Decoder()],
|
|
27
|
+
['numWritableNonSigners', getU8Decoder()],
|
|
28
|
+
['accountKeys', getArrayDecoder(getAddressDecoder())],
|
|
29
|
+
[
|
|
30
|
+
'addressTableLookups',
|
|
31
|
+
getArrayDecoder(getMessageAddressTableLookupDecoder()),
|
|
32
|
+
],
|
|
33
|
+
['instructions', getArrayDecoder(getCompiledInstructionDecoder())],
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
export function getVaultTransactionMessageCodec() {
|
|
37
|
+
return combineCodec(getVaultTransactionMessageEncoder(), getVaultTransactionMessageDecoder());
|
|
38
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
export * from './multisigCreate';
|
|
9
|
+
export * from './proposalAccountsClose';
|
|
10
|
+
export * from './proposalApprove';
|
|
11
|
+
export * from './proposalCreate';
|
|
12
|
+
export * from './proposalExecute';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun Codama to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/codama-idl/codama
|
|
7
|
+
*/
|
|
8
|
+
export * from './multisigCreate';
|
|
9
|
+
export * from './proposalAccountsClose';
|
|
10
|
+
export * from './proposalApprove';
|
|
11
|
+
export * from './proposalCreate';
|
|
12
|
+
export * from './proposalExecute';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
export declare function multisigCreate({ treasury, creator, multisigPda, threshold, members, createKey, rentCollector, }: {
|
|
3
|
+
treasury: PublicKey;
|
|
4
|
+
creator: PublicKey;
|
|
5
|
+
multisigPda: PublicKey;
|
|
6
|
+
threshold: number;
|
|
7
|
+
members: PublicKey[];
|
|
8
|
+
createKey: PublicKey;
|
|
9
|
+
rentCollector: string | null;
|
|
10
|
+
}): Promise<TransactionInstruction>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SystemProgram } from "@solana/web3.js";
|
|
2
|
+
import { getMultisigCreateInstruction } from "../generated";
|
|
3
|
+
import * as utils from "../utils";
|
|
4
|
+
import { address } from "@solana/kit";
|
|
5
|
+
import { fromLegacyPublicKey } from "@solana/compat";
|
|
6
|
+
export async function multisigCreate({ treasury, creator, multisigPda, threshold, members, createKey, rentCollector, }) {
|
|
7
|
+
const rentCollectorAddress = rentCollector && rentCollector.length > 0
|
|
8
|
+
? address(rentCollector)
|
|
9
|
+
: null;
|
|
10
|
+
const args = {
|
|
11
|
+
threshold,
|
|
12
|
+
members: members.map((pk) => fromLegacyPublicKey(pk)),
|
|
13
|
+
rentCollector: rentCollectorAddress
|
|
14
|
+
? rentCollectorAddress
|
|
15
|
+
: null,
|
|
16
|
+
};
|
|
17
|
+
let ix = getMultisigCreateInstruction({
|
|
18
|
+
treasury: fromLegacyPublicKey(treasury),
|
|
19
|
+
multisig: fromLegacyPublicKey(multisigPda),
|
|
20
|
+
createKey: fromLegacyPublicKey(createKey),
|
|
21
|
+
creator: fromLegacyPublicKey(creator),
|
|
22
|
+
systemProgram: fromLegacyPublicKey(SystemProgram.programId),
|
|
23
|
+
args,
|
|
24
|
+
});
|
|
25
|
+
return utils.toLegacyTransactionInstruction(ix, [2, 3]);
|
|
26
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
export declare function ProposalAccountsClose({ rentCollector, multisigPda, transactionIndex, }: {
|
|
3
|
+
rentCollector: PublicKey;
|
|
4
|
+
multisigPda: PublicKey;
|
|
5
|
+
transactionIndex: bigint;
|
|
6
|
+
}): Promise<TransactionInstruction>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SystemProgram } from "@solana/web3.js";
|
|
2
|
+
import { getProposalAccountsCloseInstruction } from "../generated";
|
|
3
|
+
import * as pda from "../pda";
|
|
4
|
+
import * as utils from "../utils";
|
|
5
|
+
import { fromLegacyPublicKey } from "@solana/compat";
|
|
6
|
+
export async function ProposalAccountsClose({ rentCollector, multisigPda, transactionIndex, }) {
|
|
7
|
+
let proposalPda = pda.getProposalPda({ multisigPda: multisigPda, transactionIndex: transactionIndex });
|
|
8
|
+
let txPda = pda.getTransactionPda({ multisigPda: multisigPda, index: transactionIndex });
|
|
9
|
+
console.log("tx pda", txPda[0].toString());
|
|
10
|
+
console.log("proposal pda", proposalPda[0].toString());
|
|
11
|
+
let ix = getProposalAccountsCloseInstruction({
|
|
12
|
+
multisig: fromLegacyPublicKey(multisigPda),
|
|
13
|
+
proposal: fromLegacyPublicKey(proposalPda[0]),
|
|
14
|
+
transaction: fromLegacyPublicKey(txPda[0]),
|
|
15
|
+
rentCollector: fromLegacyPublicKey(rentCollector),
|
|
16
|
+
systemProgram: fromLegacyPublicKey(SystemProgram.programId),
|
|
17
|
+
});
|
|
18
|
+
return utils.toLegacyTransactionInstruction(ix, []);
|
|
19
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
export declare function proposalApprove({ member, multisigPda, transactionIndex, }: {
|
|
3
|
+
member: PublicKey;
|
|
4
|
+
multisigPda: PublicKey;
|
|
5
|
+
transactionIndex: bigint;
|
|
6
|
+
}): Promise<TransactionInstruction>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getProposalApproveInstruction } from "../generated";
|
|
2
|
+
import * as pda from "../pda";
|
|
3
|
+
import * as utils from "../utils";
|
|
4
|
+
import { fromLegacyPublicKey } from "@solana/compat";
|
|
5
|
+
export async function proposalApprove({ member, multisigPda, transactionIndex, }) {
|
|
6
|
+
const args = {};
|
|
7
|
+
let proposalPda = pda.getProposalPda({ multisigPda: multisigPda, transactionIndex: transactionIndex });
|
|
8
|
+
let ix = getProposalApproveInstruction({
|
|
9
|
+
multisig: fromLegacyPublicKey(multisigPda),
|
|
10
|
+
proposal: fromLegacyPublicKey(proposalPda[0]),
|
|
11
|
+
member: fromLegacyPublicKey(member),
|
|
12
|
+
args,
|
|
13
|
+
});
|
|
14
|
+
return utils.toLegacyTransactionInstruction(ix, [2]);
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PublicKey, TransactionInstruction, TransactionMessage, AddressLookupTableAccount } from "@solana/web3.js";
|
|
2
|
+
export declare function proposalCreate({ creator, multisigPda, ephemeralSigners, votingDeadline, transactionMessage, addressLookupTableAccounts, transactionIndex, }: {
|
|
3
|
+
creator: PublicKey;
|
|
4
|
+
multisigPda: PublicKey;
|
|
5
|
+
ephemeralSigners: number;
|
|
6
|
+
votingDeadline: bigint;
|
|
7
|
+
transactionMessage: TransactionMessage;
|
|
8
|
+
addressLookupTableAccounts: AddressLookupTableAccount[];
|
|
9
|
+
transactionIndex: bigint;
|
|
10
|
+
}): Promise<TransactionInstruction>;
|