@aura-protocol/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +307 -0
- package/bin/aura.js +8 -0
- package/dist/commands/confidential.d.ts +2 -0
- package/dist/commands/confidential.js +564 -0
- package/dist/commands/confidential.js.map +1 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +123 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.js +29 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/dwallet.d.ts +2 -0
- package/dist/commands/dwallet.js +131 -0
- package/dist/commands/dwallet.js.map +1 -0
- package/dist/commands/execution.d.ts +2 -0
- package/dist/commands/execution.js +261 -0
- package/dist/commands/execution.js.map +1 -0
- package/dist/commands/governance.d.ts +2 -0
- package/dist/commands/governance.js +169 -0
- package/dist/commands/governance.js.map +1 -0
- package/dist/commands/helpers.d.ts +79 -0
- package/dist/commands/helpers.js +219 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/treasury.d.ts +2 -0
- package/dist/commands/treasury.js +319 -0
- package/dist/commands/treasury.js.map +1 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +96 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.js +57 -0
- package/dist/context.js.map +1 -0
- package/dist/dashboard.d.ts +7 -0
- package/dist/dashboard.js +95 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/domain.d.ts +16 -0
- package/dist/domain.js +86 -0
- package/dist/domain.js.map +1 -0
- package/dist/format.d.ts +9 -0
- package/dist/format.js +92 -0
- package/dist/format.js.map +1 -0
- package/dist/ika.d.ts +76 -0
- package/dist/ika.js +178 -0
- package/dist/ika.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +32 -0
- package/dist/output.js +134 -0
- package/dist/output.js.map +1 -0
- package/dist/protocol.d.ts +99 -0
- package/dist/protocol.js +353 -0
- package/dist/protocol.js.map +1 -0
- package/dist/sdk.d.ts +6 -0
- package/dist/sdk.js +6 -0
- package/dist/sdk.js.map +1 -0
- package/dist/treasury-view.d.ts +11 -0
- package/dist/treasury-view.js +103 -0
- package/dist/treasury-view.js.map +1 -0
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.d.ts +195 -0
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.js +514 -0
- package/dist/vendor/encrypt/generated/grpc/encrypt_service.js.map +1 -0
- package/dist/vendor/encrypt/grpc.d.ts +70 -0
- package/dist/vendor/encrypt/grpc.js +108 -0
- package/dist/vendor/encrypt/grpc.js.map +1 -0
- package/dist/vendor/ika/bcs-types.d.ts +1045 -0
- package/dist/vendor/ika/bcs-types.js +185 -0
- package/dist/vendor/ika/bcs-types.js.map +1 -0
- package/dist/vendor/ika/generated/grpc/ika_dwallet.d.ts +141 -0
- package/dist/vendor/ika/generated/grpc/ika_dwallet.js +531 -0
- package/dist/vendor/ika/generated/grpc/ika_dwallet.js.map +1 -0
- package/dist/vendor/ika/grpc.d.ts +16 -0
- package/dist/vendor/ika/grpc.js +129 -0
- package/dist/vendor/ika/grpc.js.map +1 -0
- package/dist/wallet.d.ts +2 -0
- package/dist/wallet.js +21 -0
- package/dist/wallet.js.map +1 -0
- package/package.json +54 -0
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Aura } from "@aura-protocol/sdk-ts";
|
|
2
|
+
export { AuraClient } from "@aura-protocol/sdk-ts";
|
|
3
|
+
export { AURA_PROGRAM_ID, DEVNET_RPC_URL, DWALLET_DEVNET_PROGRAM_ID, ENCRYPT_DEVNET_PROGRAM_ID, } from "@aura-protocol/sdk-ts";
|
|
4
|
+
export { deriveDwalletCpiAuthorityAddress, deriveEncryptCpiAuthorityAddress, deriveEncryptEventAuthorityAddress, } from "@aura-protocol/sdk-ts";
|
|
5
|
+
export { validateAddress, validateAgentId, validateAmountUsd, validateDwalletId, validateGuardians, validateMultisigThreshold, validateSwarmMembers, } from "@aura-protocol/sdk-ts";
|
|
6
|
+
//# sourceMappingURL=sdk.js.map
|
package/dist/sdk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import type { TreasuryAccountRecord } from "./sdk.js";
|
|
3
|
+
export interface TreasurySections {
|
|
4
|
+
overview: string;
|
|
5
|
+
policy: string;
|
|
6
|
+
confidential?: string;
|
|
7
|
+
dwallets?: string;
|
|
8
|
+
pending?: string;
|
|
9
|
+
governance?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function renderTreasurySections(treasury: PublicKey, account: TreasuryAccountRecord): TreasurySections;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { formatChain, formatProposalStatus, formatTransactionType, formatViolation, } from "./domain.js";
|
|
3
|
+
import { formatNullable, formatPercentBps, formatPubkey, formatRelativeSeconds, formatTimestamp, formatUsd, } from "./format.js";
|
|
4
|
+
import { createTable } from "./output.js";
|
|
5
|
+
function renderOverview(treasury, account) {
|
|
6
|
+
const table = createTable(["Field", "Value"]);
|
|
7
|
+
table.push(["PDA", treasury.toBase58()], ["Agent ID", account.agentId], ["Owner", account.owner.toBase58()], ["AI Authority", account.aiAuthority.toBase58()], ["Status", account.executionPaused ? "Paused" : "Active"], ["Total tx", String(account.totalTransactions)], ["Created", formatTimestamp(account.createdAt)], ["Updated", formatTimestamp(account.updatedAt)]);
|
|
8
|
+
return table.toString();
|
|
9
|
+
}
|
|
10
|
+
function renderPolicy(account) {
|
|
11
|
+
const policy = account.policyConfig;
|
|
12
|
+
const table = createTable(["Policy", "Value"]);
|
|
13
|
+
table.push(["Daily limit", formatUsd(policy.dailyLimitUsd)], ["Per-tx limit", formatUsd(policy.perTxLimitUsd)], ["Daytime hourly", formatUsd(policy.daytimeHourlyLimitUsd)], ["Nighttime hourly", formatUsd(policy.nighttimeHourlyLimitUsd)], ["Velocity limit", formatUsd(policy.velocityLimitUsd)], ["Shared pool", formatUsd(policy.sharedPoolLimitUsd)], ["Max slippage", formatPercentBps(policy.maxSlippageBps)], ["Max quote age", formatNullable(policy.maxQuoteAgeSecs)], ["Max risk score", formatNullable(policy.maxCounterpartyRiskScore)]);
|
|
14
|
+
return table.toString();
|
|
15
|
+
}
|
|
16
|
+
function renderConfidential(account) {
|
|
17
|
+
const guardrails = account.confidentialGuardrails;
|
|
18
|
+
if (!guardrails) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const table = createTable(["Confidential", "Value"]);
|
|
22
|
+
table.push(["Daily limit ct", formatPubkey(guardrails.dailyLimitCiphertext)], ["Per-tx limit ct", formatPubkey(guardrails.perTxLimitCiphertext)], ["Spent today ct", formatPubkey(guardrails.spentTodayCiphertext)], ["Vector guardrail ct", formatPubkey(guardrails.guardrailVectorCiphertext)]);
|
|
23
|
+
return table.toString();
|
|
24
|
+
}
|
|
25
|
+
function renderDwallets(account) {
|
|
26
|
+
if (account.dwallets.length === 0) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const table = createTable([
|
|
30
|
+
"Chain",
|
|
31
|
+
"dWallet ID",
|
|
32
|
+
"Address",
|
|
33
|
+
"Runtime PDA",
|
|
34
|
+
"Authorized User",
|
|
35
|
+
"Balance",
|
|
36
|
+
]);
|
|
37
|
+
for (const dwallet of account.dwallets) {
|
|
38
|
+
table.push([
|
|
39
|
+
formatChain(dwallet.chain),
|
|
40
|
+
dwallet.dwalletId,
|
|
41
|
+
dwallet.address,
|
|
42
|
+
formatPubkey(dwallet.dwalletAccount),
|
|
43
|
+
formatPubkey(dwallet.authorizedUserPubkey),
|
|
44
|
+
formatUsd(dwallet.balanceUsd),
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
return table.toString();
|
|
48
|
+
}
|
|
49
|
+
function renderPending(account) {
|
|
50
|
+
const pending = account.pending;
|
|
51
|
+
if (!pending) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const table = createTable(["Pending", "Value"]);
|
|
55
|
+
table.push(["Proposal ID", String(pending.proposalId)], ["Amount", formatUsd(pending.amountUsd)], ["Chain", formatChain(pending.targetChain)], ["Type", formatTransactionType(pending.txType)], ["Recipient", pending.recipientOrContract], ["Status", formatProposalStatus(pending.status)], ["Approved", pending.decision.approved ? "Yes" : "No"], ["Violation", formatViolation(pending.decision.violation)], ["Effective limit", formatUsd(pending.decision.effectiveDailyLimitUsd)], ["Submitted", formatTimestamp(pending.submittedAt)], [
|
|
56
|
+
"Expires",
|
|
57
|
+
`${formatTimestamp(pending.expiresAt)} (${formatRelativeSeconds(pending.expiresAt)})`,
|
|
58
|
+
], ["Policy output ct", formatNullable(pending.policyOutputCiphertextAccount)]);
|
|
59
|
+
if (pending.decryptionRequest) {
|
|
60
|
+
table.push(["Decrypt request", pending.decryptionRequest.requestAccount], ["Decrypt requested", formatTimestamp(pending.decryptionRequest.requestedAt)], ["Decrypt verified", formatTimestamp(pending.decryptionRequest.verifiedAt)], ["Plaintext sha256", formatNullable(pending.decryptionRequest.plaintextSha256)]);
|
|
61
|
+
}
|
|
62
|
+
if (pending.signatureRequest) {
|
|
63
|
+
table.push(["Message approval", pending.signatureRequest.messageApprovalAccount], ["Approval ID", pending.signatureRequest.approvalId], ["Signature requested", formatTimestamp(pending.signatureRequest.requestedAt)]);
|
|
64
|
+
}
|
|
65
|
+
return table.toString();
|
|
66
|
+
}
|
|
67
|
+
function renderGovernance(account) {
|
|
68
|
+
if (!account.multisig && !account.swarm) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const table = createTable(["Governance", "Value"]);
|
|
72
|
+
if (account.multisig) {
|
|
73
|
+
table.push([
|
|
74
|
+
"Multisig",
|
|
75
|
+
`${account.multisig.requiredSignatures}-of-${account.multisig.guardians.length}`,
|
|
76
|
+
]);
|
|
77
|
+
table.push([
|
|
78
|
+
"Guardians",
|
|
79
|
+
account.multisig.guardians.map((guardian) => formatPubkey(guardian)).join(", "),
|
|
80
|
+
]);
|
|
81
|
+
if (account.multisig.pendingOverride) {
|
|
82
|
+
table.push(["Override limit", formatUsd(account.multisig.pendingOverride.newDailyLimitUsd)], [
|
|
83
|
+
"Override sigs",
|
|
84
|
+
`${account.multisig.pendingOverride.signaturesCollected.length}/${account.multisig.requiredSignatures}`,
|
|
85
|
+
], ["Override expiry", formatTimestamp(account.multisig.pendingOverride.expiration)]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (account.swarm) {
|
|
89
|
+
table.push(["Swarm", account.swarm.swarmId], ["Members", account.swarm.memberAgents.join(", ")], ["Shared pool", formatUsd(account.swarm.sharedPoolLimitUsd)], ["Spent", formatUsd(account.swarm.totalSwarmSpentUsd)]);
|
|
90
|
+
}
|
|
91
|
+
return table.toString();
|
|
92
|
+
}
|
|
93
|
+
export function renderTreasurySections(treasury, account) {
|
|
94
|
+
return {
|
|
95
|
+
overview: renderOverview(treasury, account),
|
|
96
|
+
policy: renderPolicy(account),
|
|
97
|
+
confidential: renderConfidential(account),
|
|
98
|
+
dwallets: renderDwallets(account),
|
|
99
|
+
pending: renderPending(account),
|
|
100
|
+
governance: renderGovernance(account),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=treasury-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treasury-view.js","sourceRoot":"","sources":["../src/treasury-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY1C,SAAS,cAAc,CAAC,QAAmB,EAAE,OAA8B;IACzE,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,CACR,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAC5B,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,EAC7B,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EACnC,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,EAChD,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EACzD,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,EAC/C,CAAC,SAAS,EAAE,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAC/C,CAAC,SAAS,EAAE,eAAe,C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/wire";
|
|
2
|
+
import { type CallOptions, type ChannelCredentials, Client, type ClientOptions, type ClientUnaryCall, type handleUnaryCall, type Metadata, type ServiceError, type UntypedServiceImplementation } from "@grpc/grpc-js";
|
|
3
|
+
export declare const protobufPackage = "encrypt.v1";
|
|
4
|
+
/** Chain identifier. */
|
|
5
|
+
export declare enum Chain {
|
|
6
|
+
SOLANA = 0,
|
|
7
|
+
UNRECOGNIZED = -1
|
|
8
|
+
}
|
|
9
|
+
export declare function chainFromJSON(object: any): Chain;
|
|
10
|
+
export declare function chainToJSON(object: Chain): string;
|
|
11
|
+
/** A single encrypted input value. */
|
|
12
|
+
export interface EncryptedInput {
|
|
13
|
+
/** FHE ciphertext bytes (encrypted under the request's network_encryption_public_key). */
|
|
14
|
+
ciphertextBytes: Buffer;
|
|
15
|
+
/** FHE type discriminator (0-44). Validated server-side. */
|
|
16
|
+
fheType: number;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateInputRequest {
|
|
19
|
+
/** Target chain where the ciphertexts should be created. */
|
|
20
|
+
chain: Chain;
|
|
21
|
+
/** One or more encrypted input values to create on-chain. */
|
|
22
|
+
inputs: EncryptedInput[];
|
|
23
|
+
/** ZK proof of valid encryption covering all inputs (skipped in dev mode). */
|
|
24
|
+
proof: Buffer;
|
|
25
|
+
/**
|
|
26
|
+
* Who can use these ciphertexts (program/contract address or user address).
|
|
27
|
+
* Shared across all inputs in this batch.
|
|
28
|
+
*/
|
|
29
|
+
authorized: Buffer;
|
|
30
|
+
/**
|
|
31
|
+
* Network encryption public key all inputs were encrypted under.
|
|
32
|
+
* 32 bytes. Must match an active key registered on-chain.
|
|
33
|
+
*/
|
|
34
|
+
networkEncryptionPublicKey: Buffer;
|
|
35
|
+
}
|
|
36
|
+
export interface CreateInputResponse {
|
|
37
|
+
/** On-chain ciphertext identifiers, one per input (same order as request). */
|
|
38
|
+
ciphertextIdentifiers: Buffer[];
|
|
39
|
+
}
|
|
40
|
+
export interface ReadCiphertextRequest {
|
|
41
|
+
/** BCS-serialized ReadCiphertextMessage (the signed payload). */
|
|
42
|
+
message: Buffer;
|
|
43
|
+
/** Ed25519 signature over `message` by the authorized party. */
|
|
44
|
+
signature: Buffer;
|
|
45
|
+
/**
|
|
46
|
+
* Public key of the signer (32 bytes).
|
|
47
|
+
* Must match the ciphertext's `authorized` field, or the ciphertext must be public.
|
|
48
|
+
*/
|
|
49
|
+
signer: Buffer;
|
|
50
|
+
}
|
|
51
|
+
export interface ReadCiphertextResponse {
|
|
52
|
+
/**
|
|
53
|
+
* Production: ciphertext re-encrypted under the user's re-encryption key.
|
|
54
|
+
* The user decrypts locally with their private key.
|
|
55
|
+
* Mock: raw plaintext bytes (fhe_type determines interpretation).
|
|
56
|
+
*/
|
|
57
|
+
value: Buffer;
|
|
58
|
+
/** FHE type of the ciphertext. */
|
|
59
|
+
fheType: number;
|
|
60
|
+
/** On-chain digest (for client-side verification). */
|
|
61
|
+
digest: Buffer;
|
|
62
|
+
}
|
|
63
|
+
export declare const EncryptedInput: MessageFns<EncryptedInput>;
|
|
64
|
+
export declare const CreateInputRequest: MessageFns<CreateInputRequest>;
|
|
65
|
+
export declare const CreateInputResponse: MessageFns<CreateInputResponse>;
|
|
66
|
+
export declare const ReadCiphertextRequest: MessageFns<ReadCiphertextRequest>;
|
|
67
|
+
export declare const ReadCiphertextResponse: MessageFns<ReadCiphertextResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Client-facing gRPC API for the Encrypt executor.
|
|
70
|
+
*
|
|
71
|
+
* Same API across all chains and environments (local dev, devnet, testnet, mainnet).
|
|
72
|
+
*/
|
|
73
|
+
export type EncryptServiceService = typeof EncryptServiceService;
|
|
74
|
+
export declare const EncryptServiceService: {
|
|
75
|
+
/**
|
|
76
|
+
* Submit one or more encrypted input ciphertexts.
|
|
77
|
+
*
|
|
78
|
+
* A single ZK proof covers all inputs in the batch. All inputs share
|
|
79
|
+
* the same authorized party and network encryption key. The executor
|
|
80
|
+
* validates the proof (mock in dev mode), creates each ciphertext on-chain,
|
|
81
|
+
* and returns their identifiers ready for immediate use.
|
|
82
|
+
*/
|
|
83
|
+
readonly createInput: {
|
|
84
|
+
readonly path: "/encrypt.v1.EncryptService/CreateInput";
|
|
85
|
+
readonly requestStream: false;
|
|
86
|
+
readonly responseStream: false;
|
|
87
|
+
readonly requestSerialize: (value: CreateInputRequest) => Buffer;
|
|
88
|
+
readonly requestDeserialize: (value: Buffer) => CreateInputRequest;
|
|
89
|
+
readonly responseSerialize: (value: CreateInputResponse) => Buffer;
|
|
90
|
+
readonly responseDeserialize: (value: Buffer) => CreateInputResponse;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Read a ciphertext off-chain.
|
|
94
|
+
*
|
|
95
|
+
* The request contains a BCS-serialized ReadCiphertextMessage signed by
|
|
96
|
+
* the authorized party (or anyone if the ciphertext is public).
|
|
97
|
+
*
|
|
98
|
+
* In production: returns the ciphertext re-encrypted under the user's
|
|
99
|
+
* re-encryption key (the user decrypts locally with their private key).
|
|
100
|
+
* In mock mode: returns the plaintext value directly.
|
|
101
|
+
*
|
|
102
|
+
* Responses are cached per (ciphertext_identifier, signer, epoch).
|
|
103
|
+
* When the epoch advances, the cache is invalidated and old signatures
|
|
104
|
+
* are rejected.
|
|
105
|
+
*/
|
|
106
|
+
readonly readCiphertext: {
|
|
107
|
+
readonly path: "/encrypt.v1.EncryptService/ReadCiphertext";
|
|
108
|
+
readonly requestStream: false;
|
|
109
|
+
readonly responseStream: false;
|
|
110
|
+
readonly requestSerialize: (value: ReadCiphertextRequest) => Buffer;
|
|
111
|
+
readonly requestDeserialize: (value: Buffer) => ReadCiphertextRequest;
|
|
112
|
+
readonly responseSerialize: (value: ReadCiphertextResponse) => Buffer;
|
|
113
|
+
readonly responseDeserialize: (value: Buffer) => ReadCiphertextResponse;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export interface EncryptServiceServer extends UntypedServiceImplementation {
|
|
117
|
+
/**
|
|
118
|
+
* Submit one or more encrypted input ciphertexts.
|
|
119
|
+
*
|
|
120
|
+
* A single ZK proof covers all inputs in the batch. All inputs share
|
|
121
|
+
* the same authorized party and network encryption key. The executor
|
|
122
|
+
* validates the proof (mock in dev mode), creates each ciphertext on-chain,
|
|
123
|
+
* and returns their identifiers ready for immediate use.
|
|
124
|
+
*/
|
|
125
|
+
createInput: handleUnaryCall<CreateInputRequest, CreateInputResponse>;
|
|
126
|
+
/**
|
|
127
|
+
* Read a ciphertext off-chain.
|
|
128
|
+
*
|
|
129
|
+
* The request contains a BCS-serialized ReadCiphertextMessage signed by
|
|
130
|
+
* the authorized party (or anyone if the ciphertext is public).
|
|
131
|
+
*
|
|
132
|
+
* In production: returns the ciphertext re-encrypted under the user's
|
|
133
|
+
* re-encryption key (the user decrypts locally with their private key).
|
|
134
|
+
* In mock mode: returns the plaintext value directly.
|
|
135
|
+
*
|
|
136
|
+
* Responses are cached per (ciphertext_identifier, signer, epoch).
|
|
137
|
+
* When the epoch advances, the cache is invalidated and old signatures
|
|
138
|
+
* are rejected.
|
|
139
|
+
*/
|
|
140
|
+
readCiphertext: handleUnaryCall<ReadCiphertextRequest, ReadCiphertextResponse>;
|
|
141
|
+
}
|
|
142
|
+
export interface EncryptServiceClient extends Client {
|
|
143
|
+
/**
|
|
144
|
+
* Submit one or more encrypted input ciphertexts.
|
|
145
|
+
*
|
|
146
|
+
* A single ZK proof covers all inputs in the batch. All inputs share
|
|
147
|
+
* the same authorized party and network encryption key. The executor
|
|
148
|
+
* validates the proof (mock in dev mode), creates each ciphertext on-chain,
|
|
149
|
+
* and returns their identifiers ready for immediate use.
|
|
150
|
+
*/
|
|
151
|
+
createInput(request: CreateInputRequest, callback: (error: ServiceError | null, response: CreateInputResponse) => void): ClientUnaryCall;
|
|
152
|
+
createInput(request: CreateInputRequest, metadata: Metadata, callback: (error: ServiceError | null, response: CreateInputResponse) => void): ClientUnaryCall;
|
|
153
|
+
createInput(request: CreateInputRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: CreateInputResponse) => void): ClientUnaryCall;
|
|
154
|
+
/**
|
|
155
|
+
* Read a ciphertext off-chain.
|
|
156
|
+
*
|
|
157
|
+
* The request contains a BCS-serialized ReadCiphertextMessage signed by
|
|
158
|
+
* the authorized party (or anyone if the ciphertext is public).
|
|
159
|
+
*
|
|
160
|
+
* In production: returns the ciphertext re-encrypted under the user's
|
|
161
|
+
* re-encryption key (the user decrypts locally with their private key).
|
|
162
|
+
* In mock mode: returns the plaintext value directly.
|
|
163
|
+
*
|
|
164
|
+
* Responses are cached per (ciphertext_identifier, signer, epoch).
|
|
165
|
+
* When the epoch advances, the cache is invalidated and old signatures
|
|
166
|
+
* are rejected.
|
|
167
|
+
*/
|
|
168
|
+
readCiphertext(request: ReadCiphertextRequest, callback: (error: ServiceError | null, response: ReadCiphertextResponse) => void): ClientUnaryCall;
|
|
169
|
+
readCiphertext(request: ReadCiphertextRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ReadCiphertextResponse) => void): ClientUnaryCall;
|
|
170
|
+
readCiphertext(request: ReadCiphertextRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ReadCiphertextResponse) => void): ClientUnaryCall;
|
|
171
|
+
}
|
|
172
|
+
export declare const EncryptServiceClient: {
|
|
173
|
+
new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): EncryptServiceClient;
|
|
174
|
+
service: typeof EncryptServiceService;
|
|
175
|
+
serviceName: string;
|
|
176
|
+
};
|
|
177
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
178
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
179
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
180
|
+
} : Partial<T>;
|
|
181
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
182
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
183
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
184
|
+
} & {
|
|
185
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
186
|
+
};
|
|
187
|
+
export interface MessageFns<T> {
|
|
188
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
189
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
190
|
+
fromJSON(object: any): T;
|
|
191
|
+
toJSON(message: T): unknown;
|
|
192
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
193
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
194
|
+
}
|
|
195
|
+
export {};
|