@aura-protocol/cli 0.1.3 → 0.3.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 +84 -53
- package/bin/aura.js +0 -0
- package/dist/commands/confidential.d.ts +1 -1
- package/dist/commands/confidential.js +280 -325
- package/dist/commands/confidential.js.map +1 -1
- package/dist/commands/config.d.ts +1 -1
- package/dist/commands/config.js +26 -8
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/dashboard.d.ts +1 -1
- package/dist/commands/dashboard.js +6 -7
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/dwallet.d.ts +1 -1
- package/dist/commands/dwallet.js +52 -41
- package/dist/commands/dwallet.js.map +1 -1
- package/dist/commands/execution.d.ts +1 -1
- package/dist/commands/execution.js +111 -175
- package/dist/commands/execution.js.map +1 -1
- package/dist/commands/features.d.ts +1 -1
- package/dist/commands/features.js +15 -10
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/generated.d.ts +20 -0
- package/dist/commands/generated.js +61 -0
- package/dist/commands/generated.js.map +1 -0
- package/dist/commands/governance.d.ts +1 -1
- package/dist/commands/governance.js +113 -99
- package/dist/commands/governance.js.map +1 -1
- package/dist/commands/helpers.d.ts +5 -2
- package/dist/commands/helpers.js +79 -16
- package/dist/commands/helpers.js.map +1 -1
- package/dist/commands/instruction-exec.d.ts +27 -0
- package/dist/commands/instruction-exec.js +171 -0
- package/dist/commands/instruction-exec.js.map +1 -0
- package/dist/commands/instruction.d.ts +9 -0
- package/dist/commands/instruction.js +81 -0
- package/dist/commands/instruction.js.map +1 -0
- package/dist/commands/pda.d.ts +1 -1
- package/dist/commands/pda.js +15 -7
- package/dist/commands/pda.js.map +1 -1
- package/dist/commands/treasury.d.ts +1 -1
- package/dist/commands/treasury.js +201 -186
- package/dist/commands/treasury.js.map +1 -1
- package/dist/core/config.d.ts +35 -0
- package/dist/core/config.js +97 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/context.d.ts +51 -0
- package/dist/core/context.js +60 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/errors.d.ts +38 -0
- package/dist/core/errors.js +138 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/network.d.ts +18 -0
- package/dist/core/network.js +38 -0
- package/dist/core/network.js.map +1 -0
- package/dist/core/runner.d.ts +45 -0
- package/dist/core/runner.js +219 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/core/security.d.ts +28 -0
- package/dist/core/security.js +83 -0
- package/dist/core/security.js.map +1 -0
- package/dist/core/wallet.d.ts +2 -0
- package/dist/core/wallet.js +21 -0
- package/dist/core/wallet.js.map +1 -0
- package/dist/index.js +56 -13
- package/dist/index.js.map +1 -1
- package/dist/lib/domain.d.ts +16 -0
- package/dist/lib/domain.js +88 -0
- package/dist/lib/domain.js.map +1 -0
- package/dist/lib/ika.d.ts +81 -0
- package/dist/lib/ika.js +192 -0
- package/dist/lib/ika.js.map +1 -0
- package/dist/lib/instructions.d.ts +79 -0
- package/dist/lib/instructions.js +421 -0
- package/dist/lib/instructions.js.map +1 -0
- package/dist/lib/protocol.d.ts +99 -0
- package/dist/lib/protocol.js +327 -0
- package/dist/lib/protocol.js.map +1 -0
- package/dist/lib/treasury-view.d.ts +11 -0
- package/dist/lib/treasury-view.js +126 -0
- package/dist/lib/treasury-view.js.map +1 -0
- package/dist/program-instructions.d.ts +1 -1
- package/dist/ui/dashboard.d.ts +7 -0
- package/dist/ui/dashboard.js +99 -0
- package/dist/ui/dashboard.js.map +1 -0
- package/dist/ui/format.d.ts +9 -0
- package/dist/ui/format.js +92 -0
- package/dist/ui/format.js.map +1 -0
- package/dist/ui/output.d.ts +58 -0
- package/dist/ui/output.js +208 -0
- package/dist/ui/output.js.map +1 -0
- package/dist/ui/theme.d.ts +52 -0
- package/dist/ui/theme.js +110 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.d.ts +1 -1
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.js +36 -13
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.js.map +1 -1
- package/dist/vendor/encrypt/grpc.d.ts +2 -2
- package/dist/vendor/encrypt/grpc.js +1 -3
- package/dist/vendor/encrypt/grpc.js.map +1 -1
- package/dist/vendor/ika/bcs-types.js +107 -50
- package/dist/vendor/ika/bcs-types.js.map +1 -1
- package/dist/vendor/ika/generated/grpc/ika_dwallet.d.ts +1 -1
- package/dist/vendor/ika/generated/grpc/ika_dwallet.js +14 -4
- package/dist/vendor/ika/generated/grpc/ika_dwallet.js.map +1 -1
- package/dist/vendor/ika/grpc.d.ts +1 -1
- package/dist/vendor/ika/grpc.js +49 -24
- package/dist/vendor/ika/grpc.js.map +1 -1
- package/package.json +15 -12
- package/dist/ascii.d.ts +0 -1
- package/dist/ascii.js +0 -2
- package/dist/ascii.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrappers around the Ika Encrypt and dWallet gRPC clients.
|
|
3
|
+
*
|
|
4
|
+
* Both clients are pre-alpha — data is public plaintext on-chain, no real
|
|
5
|
+
* FHE or MPC security yet. The interfaces match the Rust smoke tests in
|
|
6
|
+
* smoke/aura-devnet/ so the full confidential + execution flow works end-to-end.
|
|
7
|
+
*
|
|
8
|
+
* Encrypt gRPC: pre-alpha-dev-1.encrypt.ika-network.net:443
|
|
9
|
+
* dWallet gRPC: pre-alpha-dev-1.ika.ika-network.net:443
|
|
10
|
+
*/
|
|
11
|
+
import { PublicKey } from "@solana/web3.js";
|
|
12
|
+
import { DEVNET_PRE_ALPHA_GRPC_URL as ENCRYPT_GRPC_URL } from "../vendor/encrypt/grpc.js";
|
|
13
|
+
import { type DKGAttestation } from "../vendor/ika/grpc.js";
|
|
14
|
+
export type { DKGAttestation };
|
|
15
|
+
declare const IKA_GRPC_URL = "pre-alpha-dev-1.ika.ika-network.net:443";
|
|
16
|
+
export { ENCRYPT_GRPC_URL, IKA_GRPC_URL };
|
|
17
|
+
/**
|
|
18
|
+
* The 32-byte network encryption public key used by the pre-alpha Encrypt service.
|
|
19
|
+
* Matches `ENCRYPT_NETWORK_KEY` in the Rust smoke tests.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ENCRYPT_NETWORK_KEY: Buffer<ArrayBuffer>;
|
|
22
|
+
/**
|
|
23
|
+
* Encrypts a single u64 value via the Ika Encrypt gRPC service and returns
|
|
24
|
+
* the on-chain ciphertext account pubkey.
|
|
25
|
+
*
|
|
26
|
+
* In pre-alpha mode the value is stored as plaintext — no real FHE yet.
|
|
27
|
+
* The returned pubkey is the `handlePda` that must be verified on-chain
|
|
28
|
+
* before it can be used in a confidential proposal.
|
|
29
|
+
*
|
|
30
|
+
* @param value The u64 value to encrypt (as a number or bigint).
|
|
31
|
+
* @param authorized The Solana pubkey authorized to use this ciphertext
|
|
32
|
+
* (typically the AURA program ID).
|
|
33
|
+
* @param grpcUrl Override the gRPC endpoint (defaults to devnet pre-alpha).
|
|
34
|
+
*/
|
|
35
|
+
export declare function encryptU64(value: number | bigint, authorized: PublicKey, grpcUrl?: string): Promise<PublicKey>;
|
|
36
|
+
/**
|
|
37
|
+
* Encrypts multiple u64 values in a single gRPC call (more efficient than
|
|
38
|
+
* calling `encryptU64` separately for each value).
|
|
39
|
+
*
|
|
40
|
+
* Returns one pubkey per input value in the same order.
|
|
41
|
+
*/
|
|
42
|
+
export declare function encryptU64Batch(values: (number | bigint)[], authorized: PublicKey, grpcUrl?: string): Promise<PublicKey[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Reads a decrypted ciphertext value from the Encrypt network.
|
|
45
|
+
*
|
|
46
|
+
* In pre-alpha mode this returns the plaintext directly.
|
|
47
|
+
* The returned buffer contains the raw bytes (8 bytes for u64 LE).
|
|
48
|
+
*
|
|
49
|
+
* @param ciphertextId The on-chain ciphertext account pubkey.
|
|
50
|
+
* @param signer The pubkey authorized to read this ciphertext.
|
|
51
|
+
* @param grpcUrl Override the gRPC endpoint.
|
|
52
|
+
*/
|
|
53
|
+
export declare function readCiphertext(ciphertextId: PublicKey, signer: PublicKey, grpcUrl?: string): Promise<{
|
|
54
|
+
value: Buffer;
|
|
55
|
+
fheType: number;
|
|
56
|
+
digest: Buffer;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Reads a u64 ciphertext and returns the decoded value.
|
|
60
|
+
* Convenience wrapper around `readCiphertext` for u64 values.
|
|
61
|
+
*/
|
|
62
|
+
export declare function readU64Ciphertext(ciphertextId: PublicKey, signer: PublicKey, grpcUrl?: string): Promise<bigint>;
|
|
63
|
+
/**
|
|
64
|
+
* Drives the dWallet presign + sign flow via the Ika dWallet gRPC service.
|
|
65
|
+
*
|
|
66
|
+
* This is called after `execute_pending` creates the `MessageApproval` account
|
|
67
|
+
* on-chain. The dWallet network processes the presign and sign requests and
|
|
68
|
+
* writes the signature back to the `MessageApproval` account.
|
|
69
|
+
*
|
|
70
|
+
* @param senderPubkey The Solana pubkey of the transaction sender (payer).
|
|
71
|
+
* @param dwalletAddr The on-chain dWallet account pubkey (32 bytes).
|
|
72
|
+
* @param message The message bytes to sign (keccak256 digest of the proposal).
|
|
73
|
+
* @param txSignature The Solana transaction signature from `execute_pending`
|
|
74
|
+
* (used as the approval proof).
|
|
75
|
+
* @param grpcUrl Override the gRPC endpoint.
|
|
76
|
+
* @param secretKey 64-byte Ed25519 secret key for signing BCS request data.
|
|
77
|
+
* @param sessionIdentifier 32-byte session identifier from DKG (live.session_identifier).
|
|
78
|
+
* @param dkgAttestation Full DKG attestation from requestDKG.
|
|
79
|
+
* @returns The dWallet signature bytes.
|
|
80
|
+
*/
|
|
81
|
+
export declare function requestDwalletSign(senderPubkey: PublicKey, _dwalletAddr: PublicKey, message: Buffer, txSignature: Buffer, grpcUrl?: string, secretKey?: Uint8Array, sessionIdentifier?: Uint8Array, dkgAttestation?: DKGAttestation): Promise<Buffer>;
|
package/dist/lib/ika.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin wrappers around the Ika Encrypt and dWallet gRPC clients.
|
|
3
|
+
*
|
|
4
|
+
* Both clients are pre-alpha — data is public plaintext on-chain, no real
|
|
5
|
+
* FHE or MPC security yet. The interfaces match the Rust smoke tests in
|
|
6
|
+
* smoke/aura-devnet/ so the full confidential + execution flow works end-to-end.
|
|
7
|
+
*
|
|
8
|
+
* Encrypt gRPC: pre-alpha-dev-1.encrypt.ika-network.net:443
|
|
9
|
+
* dWallet gRPC: pre-alpha-dev-1.ika.ika-network.net:443
|
|
10
|
+
*/
|
|
11
|
+
import { PublicKey } from "@solana/web3.js";
|
|
12
|
+
import { createEncryptClient, DEVNET_PRE_ALPHA_GRPC_URL as ENCRYPT_GRPC_URL, Chain as EncryptChain, encodeReadCiphertextMessage, } from "../vendor/encrypt/grpc.js";
|
|
13
|
+
import { createIkaClient } from "../vendor/ika/grpc.js";
|
|
14
|
+
const IKA_GRPC_URL = "pre-alpha-dev-1.ika.ika-network.net:443";
|
|
15
|
+
export { ENCRYPT_GRPC_URL, IKA_GRPC_URL };
|
|
16
|
+
/**
|
|
17
|
+
* FHE type for u64 values — matches `ENCRYPT_FHE_UINT64` in the Rust program.
|
|
18
|
+
*/
|
|
19
|
+
const FHE_TYPE_UINT64 = 4;
|
|
20
|
+
const U64_MAX = (1n << 64n) - 1n;
|
|
21
|
+
/**
|
|
22
|
+
* The 32-byte network encryption public key used by the pre-alpha Encrypt service.
|
|
23
|
+
* Matches `ENCRYPT_NETWORK_KEY` in the Rust smoke tests.
|
|
24
|
+
*/
|
|
25
|
+
export const ENCRYPT_NETWORK_KEY = Buffer.alloc(32, 0x55);
|
|
26
|
+
/**
|
|
27
|
+
* Encrypts a single u64 value via the Ika Encrypt gRPC service and returns
|
|
28
|
+
* the on-chain ciphertext account pubkey.
|
|
29
|
+
*
|
|
30
|
+
* In pre-alpha mode the value is stored as plaintext — no real FHE yet.
|
|
31
|
+
* The returned pubkey is the `handlePda` that must be verified on-chain
|
|
32
|
+
* before it can be used in a confidential proposal.
|
|
33
|
+
*
|
|
34
|
+
* @param value The u64 value to encrypt (as a number or bigint).
|
|
35
|
+
* @param authorized The Solana pubkey authorized to use this ciphertext
|
|
36
|
+
* (typically the AURA program ID).
|
|
37
|
+
* @param grpcUrl Override the gRPC endpoint (defaults to devnet pre-alpha).
|
|
38
|
+
*/
|
|
39
|
+
export async function encryptU64(value, authorized, grpcUrl = ENCRYPT_GRPC_URL) {
|
|
40
|
+
const client = createEncryptClient(grpcUrl);
|
|
41
|
+
try {
|
|
42
|
+
const bigintValue = BigInt(value);
|
|
43
|
+
if (bigintValue < 0n || bigintValue > U64_MAX) {
|
|
44
|
+
throw new Error("encryptU64 value must fit in u64");
|
|
45
|
+
}
|
|
46
|
+
// Encode the value as 8 little-endian bytes (u64 LE)
|
|
47
|
+
const valueBuf = Buffer.alloc(8);
|
|
48
|
+
valueBuf.writeBigUInt64LE(bigintValue, 0);
|
|
49
|
+
const result = await client.createInput({
|
|
50
|
+
chain: EncryptChain.Solana,
|
|
51
|
+
inputs: [
|
|
52
|
+
{
|
|
53
|
+
ciphertextBytes: valueBuf,
|
|
54
|
+
fheType: FHE_TYPE_UINT64,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
proof: Buffer.alloc(0),
|
|
58
|
+
authorized: authorized.toBuffer(),
|
|
59
|
+
networkEncryptionPublicKey: ENCRYPT_NETWORK_KEY,
|
|
60
|
+
});
|
|
61
|
+
if (result.ciphertextIdentifiers[0]?.length !== 32) {
|
|
62
|
+
throw new Error("Encrypt service returned an invalid ciphertext identifier");
|
|
63
|
+
}
|
|
64
|
+
return new PublicKey(result.ciphertextIdentifiers[0]);
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
client.close();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Encrypts multiple u64 values in a single gRPC call (more efficient than
|
|
72
|
+
* calling `encryptU64` separately for each value).
|
|
73
|
+
*
|
|
74
|
+
* Returns one pubkey per input value in the same order.
|
|
75
|
+
*/
|
|
76
|
+
export async function encryptU64Batch(values, authorized, grpcUrl = ENCRYPT_GRPC_URL) {
|
|
77
|
+
if (values.length === 0) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const client = createEncryptClient(grpcUrl);
|
|
81
|
+
try {
|
|
82
|
+
const inputs = values.map((value) => {
|
|
83
|
+
const valueBuf = Buffer.alloc(8);
|
|
84
|
+
const bigintValue = BigInt(value);
|
|
85
|
+
if (bigintValue < 0n || bigintValue > U64_MAX) {
|
|
86
|
+
throw new Error("encryptU64Batch values must fit in u64");
|
|
87
|
+
}
|
|
88
|
+
valueBuf.writeBigUInt64LE(bigintValue, 0);
|
|
89
|
+
return { ciphertextBytes: valueBuf, fheType: FHE_TYPE_UINT64 };
|
|
90
|
+
});
|
|
91
|
+
const result = await client.createInput({
|
|
92
|
+
chain: EncryptChain.Solana,
|
|
93
|
+
inputs,
|
|
94
|
+
proof: Buffer.alloc(0),
|
|
95
|
+
authorized: authorized.toBuffer(),
|
|
96
|
+
networkEncryptionPublicKey: ENCRYPT_NETWORK_KEY,
|
|
97
|
+
});
|
|
98
|
+
if (result.ciphertextIdentifiers.length !== values.length) {
|
|
99
|
+
throw new Error(`Encrypt service returned ${result.ciphertextIdentifiers.length} identifiers for ${values.length} inputs`);
|
|
100
|
+
}
|
|
101
|
+
return result.ciphertextIdentifiers.map((id) => {
|
|
102
|
+
if (id?.length !== 32) {
|
|
103
|
+
throw new Error("Encrypt service returned an invalid ciphertext identifier");
|
|
104
|
+
}
|
|
105
|
+
return new PublicKey(id);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
client.close();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Reads a decrypted ciphertext value from the Encrypt network.
|
|
114
|
+
*
|
|
115
|
+
* In pre-alpha mode this returns the plaintext directly.
|
|
116
|
+
* The returned buffer contains the raw bytes (8 bytes for u64 LE).
|
|
117
|
+
*
|
|
118
|
+
* @param ciphertextId The on-chain ciphertext account pubkey.
|
|
119
|
+
* @param signer The pubkey authorized to read this ciphertext.
|
|
120
|
+
* @param grpcUrl Override the gRPC endpoint.
|
|
121
|
+
*/
|
|
122
|
+
export async function readCiphertext(ciphertextId, signer, grpcUrl = ENCRYPT_GRPC_URL) {
|
|
123
|
+
const client = createEncryptClient(grpcUrl);
|
|
124
|
+
try {
|
|
125
|
+
// Build a BCS-encoded ReadCiphertextMessage
|
|
126
|
+
// In pre-alpha, signature and reencryption key can be zero-filled
|
|
127
|
+
const message = encodeReadCiphertextMessage(0, // chain = Solana
|
|
128
|
+
ciphertextId.toBuffer(), Buffer.alloc(32), // zero reencryption key (pre-alpha: plaintext returned directly)
|
|
129
|
+
1n);
|
|
130
|
+
const result = await client.readCiphertext({
|
|
131
|
+
message,
|
|
132
|
+
signature: Buffer.alloc(64), // zero signature (pre-alpha: not validated)
|
|
133
|
+
signer: signer.toBuffer(),
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
value: result.value,
|
|
137
|
+
fheType: result.fheType,
|
|
138
|
+
digest: result.digest,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
client.close();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Reads a u64 ciphertext and returns the decoded value.
|
|
147
|
+
* Convenience wrapper around `readCiphertext` for u64 values.
|
|
148
|
+
*/
|
|
149
|
+
export async function readU64Ciphertext(ciphertextId, signer, grpcUrl = ENCRYPT_GRPC_URL) {
|
|
150
|
+
const { value } = await readCiphertext(ciphertextId, signer, grpcUrl);
|
|
151
|
+
if (value.length < 8) {
|
|
152
|
+
throw new Error(`Expected 8 bytes for u64, got ${value.length}`);
|
|
153
|
+
}
|
|
154
|
+
return value.readBigUInt64LE(0);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Drives the dWallet presign + sign flow via the Ika dWallet gRPC service.
|
|
158
|
+
*
|
|
159
|
+
* This is called after `execute_pending` creates the `MessageApproval` account
|
|
160
|
+
* on-chain. The dWallet network processes the presign and sign requests and
|
|
161
|
+
* writes the signature back to the `MessageApproval` account.
|
|
162
|
+
*
|
|
163
|
+
* @param senderPubkey The Solana pubkey of the transaction sender (payer).
|
|
164
|
+
* @param dwalletAddr The on-chain dWallet account pubkey (32 bytes).
|
|
165
|
+
* @param message The message bytes to sign (keccak256 digest of the proposal).
|
|
166
|
+
* @param txSignature The Solana transaction signature from `execute_pending`
|
|
167
|
+
* (used as the approval proof).
|
|
168
|
+
* @param grpcUrl Override the gRPC endpoint.
|
|
169
|
+
* @param secretKey 64-byte Ed25519 secret key for signing BCS request data.
|
|
170
|
+
* @param sessionIdentifier 32-byte session identifier from DKG (live.session_identifier).
|
|
171
|
+
* @param dkgAttestation Full DKG attestation from requestDKG.
|
|
172
|
+
* @returns The dWallet signature bytes.
|
|
173
|
+
*/
|
|
174
|
+
export async function requestDwalletSign(senderPubkey, _dwalletAddr, message, txSignature, grpcUrl = IKA_GRPC_URL, secretKey, sessionIdentifier, dkgAttestation) {
|
|
175
|
+
if (!sessionIdentifier || !dkgAttestation) {
|
|
176
|
+
throw new Error("requestDwalletSign requires sessionIdentifier and dkgAttestation from DKG. " +
|
|
177
|
+
"Pass the values returned by provisionDwallet().");
|
|
178
|
+
}
|
|
179
|
+
const client = createIkaClient(grpcUrl, secretKey);
|
|
180
|
+
try {
|
|
181
|
+
const senderBytes = senderPubkey.toBuffer();
|
|
182
|
+
// Step 1: request presign using the DKG session identifier
|
|
183
|
+
const presignId = await client.requestPresign(senderBytes, sessionIdentifier);
|
|
184
|
+
// Step 2: request sign with the presign ID, approval proof, and DKG attestation
|
|
185
|
+
const signature = await client.requestSign(senderBytes, sessionIdentifier, message, presignId, txSignature, dkgAttestation);
|
|
186
|
+
return Buffer.from(signature);
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
client.close();
|
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AC;IACD,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QAE5C,2DAA2D;QAC3D,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,cAAc,CAC3C,WAAW,EACX,iBAAiB,CAClB,CAAC;QAEF,gFAAgF;QAChF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,WAAW,CACxC,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,WAAW,EACX,cAAc,CACf,CAAC;QAEF,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type AuraClient } from "@aura-protocol/sdk-ts";
|
|
2
|
+
import { PublicKey, type TransactionInstruction } from "@solana/web3.js";
|
|
3
|
+
type JsonRecord = Record<string, unknown>;
|
|
4
|
+
export interface ProgramInstructionInput {
|
|
5
|
+
instruction: string;
|
|
6
|
+
accounts: JsonRecord;
|
|
7
|
+
args: JsonRecord | unknown[];
|
|
8
|
+
}
|
|
9
|
+
export interface InstructionAccountSchema {
|
|
10
|
+
name: string;
|
|
11
|
+
camelName: string;
|
|
12
|
+
signer: boolean;
|
|
13
|
+
writable: boolean;
|
|
14
|
+
optional: boolean;
|
|
15
|
+
address?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface InstructionArgSchema {
|
|
18
|
+
name: string;
|
|
19
|
+
camelName: string;
|
|
20
|
+
type: unknown;
|
|
21
|
+
typeLabel: string;
|
|
22
|
+
sample: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface ProgramInstructionSchema {
|
|
25
|
+
name: string;
|
|
26
|
+
camelName: string;
|
|
27
|
+
accounts: InstructionAccountSchema[];
|
|
28
|
+
args: InstructionArgSchema[];
|
|
29
|
+
}
|
|
30
|
+
export interface ProgramInstructionBuild {
|
|
31
|
+
schema: ProgramInstructionSchema;
|
|
32
|
+
normalizedAccounts: JsonRecord;
|
|
33
|
+
normalizedArgs: unknown[];
|
|
34
|
+
instruction: TransactionInstruction;
|
|
35
|
+
requiredSigners: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function toCamelCase(value: string): string;
|
|
38
|
+
export declare function getProgramInstructionSchema(name: string): ProgramInstructionSchema;
|
|
39
|
+
export declare function getProgramInstructionCatalog(): {
|
|
40
|
+
domains: {
|
|
41
|
+
instructions: {
|
|
42
|
+
schema: ProgramInstructionSchema | null;
|
|
43
|
+
name: string;
|
|
44
|
+
label: string;
|
|
45
|
+
description: string;
|
|
46
|
+
maturity: import("@aura-protocol/sdk-ts").AuraFeatureMaturity;
|
|
47
|
+
}[];
|
|
48
|
+
id: import("@aura-protocol/sdk-ts").AuraFeatureDomainId;
|
|
49
|
+
label: string;
|
|
50
|
+
description: string;
|
|
51
|
+
}[];
|
|
52
|
+
totals: {
|
|
53
|
+
domains: number;
|
|
54
|
+
instructions: 161;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare function buildProgramInstruction(client: AuraClient, input: ProgramInstructionInput, options: {
|
|
58
|
+
programId: PublicKey;
|
|
59
|
+
defaultSigner?: PublicKey;
|
|
60
|
+
}): Promise<ProgramInstructionBuild>;
|
|
61
|
+
export declare function parseJsonInput(value: string | undefined, label: string): JsonRecord | unknown[];
|
|
62
|
+
export declare function parseKeyValuePairs(values: string[] | undefined): JsonRecord;
|
|
63
|
+
export declare function mergeJsonInput(base: JsonRecord | unknown[], overrides: JsonRecord): JsonRecord | unknown[];
|
|
64
|
+
export declare function serializeInstructionBuild(build: ProgramInstructionBuild): {
|
|
65
|
+
schema: ProgramInstructionSchema;
|
|
66
|
+
normalizedAccounts: JsonRecord;
|
|
67
|
+
normalizedArgs: unknown[];
|
|
68
|
+
instruction: {
|
|
69
|
+
programId: string;
|
|
70
|
+
accounts: {
|
|
71
|
+
pubkey: string;
|
|
72
|
+
isSigner: boolean;
|
|
73
|
+
isWritable: boolean;
|
|
74
|
+
}[];
|
|
75
|
+
dataBase64: string;
|
|
76
|
+
};
|
|
77
|
+
requiredSigners: string[];
|
|
78
|
+
};
|
|
79
|
+
export {};
|