@inco/shield-js 0.1.0 → 0.2.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 +52 -308
- package/dist/contracts/abi.d.ts +2000 -4513
- package/dist/contracts/abi.js +2400 -5651
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js +2 -2
- package/dist/contracts/utils.d.ts +5 -24
- package/dist/contracts/utils.js +13 -24
- package/dist/errors.d.ts +16 -47
- package/dist/errors.js +6 -53
- package/dist/generated/inco/shield/v2/conductor_pb.d.ts +77 -0
- package/dist/generated/inco/shield/v2/conductor_pb.js +6 -0
- package/dist/generated/inco/shield/v2/deposit_pb.d.ts +12 -103
- package/dist/generated/inco/shield/v2/deposit_pb.js +4 -141
- package/dist/generated/inco/shield/v2/drafting_pb.d.ts +45 -269
- package/dist/generated/inco/shield/v2/drafting_pb.js +8 -361
- package/dist/generated/inco/shield/v2/types_pb.d.ts +47 -166
- package/dist/generated/inco/shield/v2/types_pb.js +12 -261
- package/dist/index.d.ts +1 -7
- package/dist/index.js +1 -14
- package/dist/shield/abi.d.ts +5 -0
- package/dist/shield/abi.js +28 -0
- package/dist/shield/client.d.ts +27 -51
- package/dist/shield/client.js +73 -65
- package/dist/shield/convert.d.ts +2 -14
- package/dist/shield/convert.js +39 -115
- package/dist/shield/encryption.d.ts +0 -67
- package/dist/shield/encryption.js +0 -67
- package/dist/shield/envelope.d.ts +10 -11
- package/dist/shield/envelope.js +15 -14
- package/dist/shield/fee.d.ts +24 -0
- package/dist/shield/fee.js +151 -0
- package/dist/shield/index.d.ts +9 -3
- package/dist/shield/index.js +7 -2
- package/dist/shield/intent.d.ts +20 -933
- package/dist/shield/intent.js +92 -112
- package/dist/shield/permission-status.d.ts +9 -0
- package/dist/shield/permission-status.js +8 -0
- package/dist/shield/rpc.d.ts +50 -49
- package/dist/shield/rpc.js +207 -354
- package/dist/shield/shield.eip712.gen.d.ts +1096 -43
- package/dist/shield/shield.eip712.gen.js +572 -62
- package/dist/shield/types.d.ts +7 -102
- package/dist/shield/types.js +1 -4
- package/dist/shield/userop/gas-estimation.d.ts +7 -22
- package/dist/shield/userop/gas-estimation.js +100 -137
- package/dist/shield/userop/paymaster.d.ts +15 -0
- package/dist/shield/userop/paymaster.js +17 -0
- package/dist/shield/userop/token-exchange.d.ts +5 -52
- package/dist/shield/userop/token-exchange.js +41 -149
- package/dist/shield/userop/types.d.ts +2 -27
- package/dist/shield/userop/types.js +0 -3
- package/dist/shield/userop/userOp.d.ts +0 -19
- package/dist/shield/userop/userOp.js +4 -22
- package/dist/shield/utils/chain.d.ts +1 -0
- package/dist/shield/utils/chain.js +3 -0
- package/dist/shield/validate-withdrawal-split.d.ts +13 -0
- package/dist/shield/validate-withdrawal-split.js +93 -0
- package/package.json +18 -27
- package/dist/generated/inco/shield/v2/conductor_connect.d.ts +0 -137
- package/dist/generated/inco/shield/v2/conductor_connect.js +0 -141
- package/dist/generated/inco/shield/v2/permission_pb.d.ts +0 -443
- package/dist/generated/inco/shield/v2/permission_pb.js +0 -639
- package/dist/generated/inco/shield/v2/query_pb.d.ts +0 -103
- package/dist/generated/inco/shield/v2/query_pb.js +0 -141
- package/dist/shield/userop/index.d.ts +0 -1
- package/dist/shield/userop/index.js +0 -1
- package/dist/uniswap-adapter/config.d.ts +0 -34
- package/dist/uniswap-adapter/config.js +0 -45
- package/dist/uniswap-adapter/find-pools.d.ts +0 -91
- package/dist/uniswap-adapter/find-pools.js +0 -108
- package/dist/uniswap-adapter/index.d.ts +0 -10
- package/dist/uniswap-adapter/index.js +0 -13
- package/dist/uniswap-adapter/swap.d.ts +0 -344
- package/dist/uniswap-adapter/swap.js +0 -309
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { erc20AdapterAbi, incoShieldAbi, iShieldSignatureVerifierAbi,
|
|
2
|
-
export { computeErc20AssetId
|
|
1
|
+
export { erc20AdapterAbi, incoShieldAbi, iShieldSignatureVerifierAbi, teeSmartAccountAbi, } from './abi.js';
|
|
2
|
+
export { computeErc20AssetId } from './utils.js';
|
package/dist/contracts/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { erc20AdapterAbi, incoShieldAbi, iShieldSignatureVerifierAbi,
|
|
2
|
-
export { computeErc20AssetId
|
|
1
|
+
export { erc20AdapterAbi, incoShieldAbi, iShieldSignatureVerifierAbi, teeSmartAccountAbi, } from './abi.js';
|
|
2
|
+
export { computeErc20AssetId } from './utils.js';
|
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Matches `Erc20Adapter.getAssetId()` on-chain:
|
|
5
|
-
* `keccak256(abi.encodePacked(tokenAddress, "Erc20"))`
|
|
6
|
-
*/
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { Asset } from '../shield/shield.eip712.gen.js';
|
|
3
|
+
export declare const ERC20_ASSET_STANDARD = 0;
|
|
7
4
|
export declare function computeErc20AssetId(tokenAddress: Hex): Hex;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
name: TName;
|
|
11
|
-
}>;
|
|
12
|
-
/**
|
|
13
|
-
* Return the sole input parameter of an ABI function that takes exactly one
|
|
14
|
-
* argument — the "wrap a single struct" convention this codebase uses to
|
|
15
|
-
* piggyback Solidity types onto the ABI. Pulls the otherwise-arbitrary
|
|
16
|
-
* `.inputs[0]` lookup out of every call site so `decodeAbiParameters` /
|
|
17
|
-
* `encodeAbiParameters` invocations read as their domain meaning.
|
|
18
|
-
*
|
|
19
|
-
* Throws if the function is absent from the ABI or if it does not take
|
|
20
|
-
* exactly one input — both indicate the caller picked the wrong helper.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getAbiFromUnitFunction<TAbi extends Abi, TName extends Extract<TAbi[number], {
|
|
23
|
-
type: 'function';
|
|
24
|
-
}>['name']>(abi: TAbi, name: TName): AbiFunctionByName<TAbi, TName>['inputs'][0];
|
|
25
|
-
export {};
|
|
5
|
+
export declare function erc20Asset(tokenAddress: Hex): Asset;
|
|
6
|
+
export declare const NATIVE_ASSET: Asset;
|
package/dist/contracts/utils.js
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import { encodePacked, getAddress, keccak256 } from 'viem';
|
|
2
|
-
|
|
3
|
-
* Compute the shield-internal asset ID for an ERC-20 token.
|
|
4
|
-
* Matches `Erc20Adapter.getAssetId()` on-chain:
|
|
5
|
-
* `keccak256(abi.encodePacked(tokenAddress, "Erc20"))`
|
|
6
|
-
*/
|
|
1
|
+
import { encodePacked, getAddress, keccak256, zeroAddress, } from 'viem';
|
|
2
|
+
export const ERC20_ASSET_STANDARD = 0;
|
|
7
3
|
export function computeErc20AssetId(tokenAddress) {
|
|
8
4
|
return keccak256(encodePacked(['address', 'string'], [getAddress(tokenAddress), 'Erc20']));
|
|
9
5
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
* Throws if the function is absent from the ABI or if it does not take
|
|
18
|
-
* exactly one input — both indicate the caller picked the wrong helper.
|
|
19
|
-
*/
|
|
20
|
-
export function getAbiFromUnitFunction(abi, name) {
|
|
21
|
-
const fn = abi.find((item) => item.type === 'function' && item.name === name);
|
|
22
|
-
if (!fn)
|
|
23
|
-
throw new Error(`abi missing function "${name}"`);
|
|
24
|
-
if (fn.inputs.length !== 1) {
|
|
25
|
-
throw new Error(`abi function "${name}" expected to take 1 input, got ${fn.inputs.length}`);
|
|
26
|
-
}
|
|
27
|
-
return fn.inputs[0];
|
|
6
|
+
export function erc20Asset(tokenAddress) {
|
|
7
|
+
return {
|
|
8
|
+
standard: ERC20_ASSET_STANDARD,
|
|
9
|
+
token: getAddress(tokenAddress),
|
|
10
|
+
tokenId: 0n,
|
|
11
|
+
};
|
|
28
12
|
}
|
|
13
|
+
export const NATIVE_ASSET = {
|
|
14
|
+
standard: ERC20_ASSET_STANDARD,
|
|
15
|
+
token: zeroAddress,
|
|
16
|
+
tokenId: 0n,
|
|
17
|
+
};
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,70 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lightweight tagged-error helper compatible with effect's `Data.TaggedError`
|
|
3
|
-
* shape (`_tag` discriminator + `Error` subclass) without taking `effect` as
|
|
4
|
-
* a runtime dependency.
|
|
5
|
-
*
|
|
6
|
-
* Usage mirrors `Data.TaggedError` so consumers using effect can catch these
|
|
7
|
-
* with `Effect.catchTag` (which keys on the `_tag` field) and consumers
|
|
8
|
-
* without effect can use plain `try`/`catch` with `instanceof` or `_tag`
|
|
9
|
-
* discrimination.
|
|
10
|
-
*
|
|
11
|
-
* class MyError extends TaggedError('MyError')<{ readonly foo: string }> {}
|
|
12
|
-
*
|
|
13
|
-
* throw new MyError({ foo: 'bar', message: 'optional human message' });
|
|
14
|
-
*
|
|
15
|
-
* try { ... } catch (err) {
|
|
16
|
-
* if (err instanceof MyError) { ... }
|
|
17
|
-
* // or: if (err && typeof err === 'object' && err._tag === 'MyError')
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
* The optional `message` field (if provided in the args object) populates
|
|
21
|
-
* `Error.prototype.message`; otherwise the tag is used as the message.
|
|
22
|
-
*/
|
|
23
1
|
type TaggedErrorConstructor<Tag extends string> = new <Fields extends Record<string, unknown>>(fields: Fields) => Error & {
|
|
24
2
|
readonly _tag: Tag;
|
|
25
3
|
} & Readonly<Fields>;
|
|
26
4
|
export declare function TaggedError<Tag extends string>(tag: Tag): TaggedErrorConstructor<Tag>;
|
|
27
5
|
declare const ShieldError_base: TaggedErrorConstructor<"ShieldError">;
|
|
28
|
-
/**
|
|
29
|
-
* Generic application-level error from the shield covalidator. Prefer a
|
|
30
|
-
* specific tagged error where the failure mode is well-defined; reach for
|
|
31
|
-
* `ShieldError` only as a last resort.
|
|
32
|
-
*/
|
|
33
6
|
export declare class ShieldError extends ShieldError_base<{
|
|
34
7
|
readonly message: string;
|
|
35
8
|
}> {
|
|
36
9
|
}
|
|
37
10
|
declare const CovalidatorError_base: TaggedErrorConstructor<"CovalidatorError">;
|
|
38
|
-
/**
|
|
39
|
-
* The covalidator returned a payload whose decrypted error message is set;
|
|
40
|
-
* the inner `errorMessage` carries server-side detail.
|
|
41
|
-
*/
|
|
42
11
|
export declare class CovalidatorError extends CovalidatorError_base<{
|
|
43
12
|
readonly message: string;
|
|
44
13
|
}> {
|
|
45
14
|
}
|
|
46
15
|
declare const MissingWalletAccount_base: TaggedErrorConstructor<"MissingWalletAccount">;
|
|
47
|
-
/** A required wallet account was missing from the WalletClient. */
|
|
48
16
|
export declare class MissingWalletAccount extends MissingWalletAccount_base<{
|
|
49
17
|
readonly message: string;
|
|
50
18
|
}> {
|
|
51
19
|
}
|
|
52
20
|
declare const MalformedProto_base: TaggedErrorConstructor<"MalformedProto">;
|
|
53
|
-
/** A required field was missing from a decoded protobuf message. */
|
|
54
21
|
export declare class MalformedProto extends MalformedProto_base<{
|
|
55
22
|
readonly message: string;
|
|
56
23
|
readonly field: string;
|
|
57
24
|
}> {
|
|
58
25
|
}
|
|
59
26
|
declare const UnknownProtoTag_base: TaggedErrorConstructor<"UnknownProtoTag">;
|
|
60
|
-
/** A protobuf oneof or tag was unrecognized. */
|
|
61
27
|
export declare class UnknownProtoTag extends UnknownProtoTag_base<{
|
|
62
28
|
readonly message: string;
|
|
63
29
|
readonly tag: string;
|
|
64
30
|
}> {
|
|
65
31
|
}
|
|
66
32
|
declare const InvalidContractReturnType_base: TaggedErrorConstructor<"InvalidContractReturnType">;
|
|
67
|
-
/** A contract read or simulation returned a value of the wrong runtime type. */
|
|
68
33
|
export declare class InvalidContractReturnType extends InvalidContractReturnType_base<{
|
|
69
34
|
readonly message: string;
|
|
70
35
|
readonly functionName: string;
|
|
@@ -72,52 +37,56 @@ export declare class InvalidContractReturnType extends InvalidContractReturnType
|
|
|
72
37
|
}> {
|
|
73
38
|
}
|
|
74
39
|
declare const BundlerGasEstimateIncomplete_base: TaggedErrorConstructor<"BundlerGasEstimateIncomplete">;
|
|
75
|
-
/** Bundler returned an incomplete gas estimate — paymaster sub-limits absent. */
|
|
76
40
|
export declare class BundlerGasEstimateIncomplete extends BundlerGasEstimateIncomplete_base<{
|
|
77
41
|
readonly message: string;
|
|
78
42
|
readonly missingFields: readonly string[];
|
|
79
43
|
}> {
|
|
80
44
|
}
|
|
45
|
+
declare const MissingPaymasterAddress_base: TaggedErrorConstructor<"MissingPaymasterAddress">;
|
|
46
|
+
export declare class MissingPaymasterAddress extends MissingPaymasterAddress_base<{
|
|
47
|
+
readonly message: string;
|
|
48
|
+
}> {
|
|
49
|
+
}
|
|
50
|
+
declare const UnsupportedFeeToken_base: TaggedErrorConstructor<"UnsupportedFeeToken">;
|
|
51
|
+
export declare class UnsupportedFeeToken extends UnsupportedFeeToken_base<{
|
|
52
|
+
readonly message: string;
|
|
53
|
+
readonly feeToken: string;
|
|
54
|
+
}> {
|
|
55
|
+
}
|
|
56
|
+
declare const InvalidWithdrawalIntentOp_base: TaggedErrorConstructor<"InvalidWithdrawalIntentOp">;
|
|
57
|
+
export declare class InvalidWithdrawalIntentOp extends InvalidWithdrawalIntentOp_base<{
|
|
58
|
+
readonly message: string;
|
|
59
|
+
}> {
|
|
60
|
+
}
|
|
81
61
|
declare const TransactionReverted_base: TaggedErrorConstructor<"TransactionReverted">;
|
|
82
|
-
/** A transaction was sent but reverted on chain. */
|
|
83
62
|
export declare class TransactionReverted extends TransactionReverted_base<{
|
|
84
63
|
readonly message: string;
|
|
85
64
|
readonly operation: string;
|
|
86
65
|
}> {
|
|
87
66
|
}
|
|
88
67
|
declare const InvalidTransactionReceipt_base: TaggedErrorConstructor<"InvalidTransactionReceipt">;
|
|
89
|
-
/** A transaction receipt lacked an expected field (block number, log, topic, ...). */
|
|
90
68
|
export declare class InvalidTransactionReceipt extends InvalidTransactionReceipt_base<{
|
|
91
69
|
readonly message: string;
|
|
92
70
|
}> {
|
|
93
71
|
}
|
|
94
72
|
declare const MissingEventLog_base: TaggedErrorConstructor<"MissingEventLog">;
|
|
95
|
-
/** An expected event log was missing from a transaction receipt. */
|
|
96
73
|
export declare class MissingEventLog extends MissingEventLog_base<{
|
|
97
74
|
readonly message: string;
|
|
98
75
|
readonly eventName: string;
|
|
99
76
|
}> {
|
|
100
77
|
}
|
|
101
78
|
declare const MalformedEventLog_base: TaggedErrorConstructor<"MalformedEventLog">;
|
|
102
|
-
/** An event log was present but its shape (topics, data) was unexpected. */
|
|
103
79
|
export declare class MalformedEventLog extends MalformedEventLog_base<{
|
|
104
80
|
readonly message: string;
|
|
105
81
|
readonly eventName: string;
|
|
106
82
|
}> {
|
|
107
83
|
}
|
|
108
84
|
declare const EncryptionError_base: TaggedErrorConstructor<"EncryptionError">;
|
|
109
|
-
/** Encryption / decryption / key-handling failed in a recoverable way. */
|
|
110
85
|
export declare class EncryptionError extends EncryptionError_base<{
|
|
111
86
|
readonly message: string;
|
|
112
87
|
}> {
|
|
113
88
|
}
|
|
114
89
|
declare const HpkeKeyPairDerivationFailure_base: TaggedErrorConstructor<"HpkeKeyPairDerivationFailure">;
|
|
115
|
-
/**
|
|
116
|
-
* Failure deriving an HPKE keypair from input keying material. The
|
|
117
|
-
* `message` carries any underlying `@hpke/hybridkem-x-wing` exception text
|
|
118
|
-
* folded in at construction (their error classes are not exported as
|
|
119
|
-
* public API, so we can't preserve them as a typed `cause`).
|
|
120
|
-
*/
|
|
121
90
|
export declare class HpkeKeyPairDerivationFailure extends HpkeKeyPairDerivationFailure_base<{
|
|
122
91
|
readonly message: string;
|
|
123
92
|
}> {
|
package/dist/errors.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lightweight tagged-error helper compatible with effect's `Data.TaggedError`
|
|
3
|
-
* shape (`_tag` discriminator + `Error` subclass) without taking `effect` as
|
|
4
|
-
* a runtime dependency.
|
|
5
|
-
*
|
|
6
|
-
* Usage mirrors `Data.TaggedError` so consumers using effect can catch these
|
|
7
|
-
* with `Effect.catchTag` (which keys on the `_tag` field) and consumers
|
|
8
|
-
* without effect can use plain `try`/`catch` with `instanceof` or `_tag`
|
|
9
|
-
* discrimination.
|
|
10
|
-
*
|
|
11
|
-
* class MyError extends TaggedError('MyError')<{ readonly foo: string }> {}
|
|
12
|
-
*
|
|
13
|
-
* throw new MyError({ foo: 'bar', message: 'optional human message' });
|
|
14
|
-
*
|
|
15
|
-
* try { ... } catch (err) {
|
|
16
|
-
* if (err instanceof MyError) { ... }
|
|
17
|
-
* // or: if (err && typeof err === 'object' && err._tag === 'MyError')
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
* The optional `message` field (if provided in the args object) populates
|
|
21
|
-
* `Error.prototype.message`; otherwise the tag is used as the message.
|
|
22
|
-
*/
|
|
23
1
|
export function TaggedError(tag) {
|
|
24
2
|
class TaggedErrorImpl extends Error {
|
|
25
3
|
_tag = tag;
|
|
@@ -30,62 +8,37 @@ export function TaggedError(tag) {
|
|
|
30
8
|
Object.assign(this, fields);
|
|
31
9
|
}
|
|
32
10
|
}
|
|
33
|
-
// The runtime class accepts any record; the cast exposes the phantom-typed
|
|
34
|
-
// generic constructor that mirrors Data.TaggedError's API.
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
36
11
|
return TaggedErrorImpl;
|
|
37
12
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Generic application-level error from the shield covalidator. Prefer a
|
|
40
|
-
* specific tagged error where the failure mode is well-defined; reach for
|
|
41
|
-
* `ShieldError` only as a last resort.
|
|
42
|
-
*/
|
|
43
13
|
export class ShieldError extends TaggedError('ShieldError') {
|
|
44
14
|
}
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
// SDK-wide tagged errors
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
/**
|
|
49
|
-
* The covalidator returned a payload whose decrypted error message is set;
|
|
50
|
-
* the inner `errorMessage` carries server-side detail.
|
|
51
|
-
*/
|
|
52
15
|
export class CovalidatorError extends TaggedError('CovalidatorError') {
|
|
53
16
|
}
|
|
54
|
-
/** A required wallet account was missing from the WalletClient. */
|
|
55
17
|
export class MissingWalletAccount extends TaggedError('MissingWalletAccount') {
|
|
56
18
|
}
|
|
57
|
-
/** A required field was missing from a decoded protobuf message. */
|
|
58
19
|
export class MalformedProto extends TaggedError('MalformedProto') {
|
|
59
20
|
}
|
|
60
|
-
/** A protobuf oneof or tag was unrecognized. */
|
|
61
21
|
export class UnknownProtoTag extends TaggedError('UnknownProtoTag') {
|
|
62
22
|
}
|
|
63
|
-
/** A contract read or simulation returned a value of the wrong runtime type. */
|
|
64
23
|
export class InvalidContractReturnType extends TaggedError('InvalidContractReturnType') {
|
|
65
24
|
}
|
|
66
|
-
/** Bundler returned an incomplete gas estimate — paymaster sub-limits absent. */
|
|
67
25
|
export class BundlerGasEstimateIncomplete extends TaggedError('BundlerGasEstimateIncomplete') {
|
|
68
26
|
}
|
|
69
|
-
|
|
27
|
+
export class MissingPaymasterAddress extends TaggedError('MissingPaymasterAddress') {
|
|
28
|
+
}
|
|
29
|
+
export class UnsupportedFeeToken extends TaggedError('UnsupportedFeeToken') {
|
|
30
|
+
}
|
|
31
|
+
export class InvalidWithdrawalIntentOp extends TaggedError('InvalidWithdrawalIntentOp') {
|
|
32
|
+
}
|
|
70
33
|
export class TransactionReverted extends TaggedError('TransactionReverted') {
|
|
71
34
|
}
|
|
72
|
-
/** A transaction receipt lacked an expected field (block number, log, topic, ...). */
|
|
73
35
|
export class InvalidTransactionReceipt extends TaggedError('InvalidTransactionReceipt') {
|
|
74
36
|
}
|
|
75
|
-
/** An expected event log was missing from a transaction receipt. */
|
|
76
37
|
export class MissingEventLog extends TaggedError('MissingEventLog') {
|
|
77
38
|
}
|
|
78
|
-
/** An event log was present but its shape (topics, data) was unexpected. */
|
|
79
39
|
export class MalformedEventLog extends TaggedError('MalformedEventLog') {
|
|
80
40
|
}
|
|
81
|
-
/** Encryption / decryption / key-handling failed in a recoverable way. */
|
|
82
41
|
export class EncryptionError extends TaggedError('EncryptionError') {
|
|
83
42
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Failure deriving an HPKE keypair from input keying material. The
|
|
86
|
-
* `message` carries any underlying `@hpke/hybridkem-x-wing` exception text
|
|
87
|
-
* folded in at construction (their error classes are not exported as
|
|
88
|
-
* public API, so we can't preserve them as a typed `cause`).
|
|
89
|
-
*/
|
|
90
43
|
export class HpkeKeyPairDerivationFailure extends TaggedError('HpkeKeyPairDerivationFailure') {
|
|
91
44
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { EncryptedEnvelopeSchema, EncryptedResponseSchema, Handle } from "./types_pb.js";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
export declare const file_inco_shield_v2_conductor: GenFile;
|
|
5
|
+
export type GetLatestHandleRequest = Message<"inco.shield.v2.GetLatestHandleRequest"> & {};
|
|
6
|
+
export declare const GetLatestHandleRequestSchema: GenMessage<GetLatestHandleRequest>;
|
|
7
|
+
export type GetLatestHandleResponse = Message<"inco.shield.v2.GetLatestHandleResponse"> & {
|
|
8
|
+
handle?: Handle | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare const GetLatestHandleResponseSchema: GenMessage<GetLatestHandleResponse>;
|
|
11
|
+
export declare const ConductorService: GenService<{
|
|
12
|
+
draft: {
|
|
13
|
+
methodKind: "unary";
|
|
14
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
15
|
+
output: typeof EncryptedResponseSchema;
|
|
16
|
+
};
|
|
17
|
+
permit: {
|
|
18
|
+
methodKind: "unary";
|
|
19
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
20
|
+
output: typeof EncryptedResponseSchema;
|
|
21
|
+
};
|
|
22
|
+
getBalance: {
|
|
23
|
+
methodKind: "unary";
|
|
24
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
25
|
+
output: typeof EncryptedResponseSchema;
|
|
26
|
+
};
|
|
27
|
+
getPortfolio: {
|
|
28
|
+
methodKind: "unary";
|
|
29
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
30
|
+
output: typeof EncryptedResponseSchema;
|
|
31
|
+
};
|
|
32
|
+
getBalanceHistory: {
|
|
33
|
+
methodKind: "unary";
|
|
34
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
35
|
+
output: typeof EncryptedResponseSchema;
|
|
36
|
+
};
|
|
37
|
+
getPortfolioHistory: {
|
|
38
|
+
methodKind: "unary";
|
|
39
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
40
|
+
output: typeof EncryptedResponseSchema;
|
|
41
|
+
};
|
|
42
|
+
requestDepositAttestation: {
|
|
43
|
+
methodKind: "unary";
|
|
44
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
45
|
+
output: typeof EncryptedResponseSchema;
|
|
46
|
+
};
|
|
47
|
+
getPermissionsByOwner: {
|
|
48
|
+
methodKind: "unary";
|
|
49
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
50
|
+
output: typeof EncryptedResponseSchema;
|
|
51
|
+
};
|
|
52
|
+
getPermissionsBySpender: {
|
|
53
|
+
methodKind: "unary";
|
|
54
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
55
|
+
output: typeof EncryptedResponseSchema;
|
|
56
|
+
};
|
|
57
|
+
getPermissionDetails: {
|
|
58
|
+
methodKind: "unary";
|
|
59
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
60
|
+
output: typeof EncryptedResponseSchema;
|
|
61
|
+
};
|
|
62
|
+
getSpendable: {
|
|
63
|
+
methodKind: "unary";
|
|
64
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
65
|
+
output: typeof EncryptedResponseSchema;
|
|
66
|
+
};
|
|
67
|
+
getOwnerGeneration: {
|
|
68
|
+
methodKind: "unary";
|
|
69
|
+
input: typeof EncryptedEnvelopeSchema;
|
|
70
|
+
output: typeof EncryptedResponseSchema;
|
|
71
|
+
};
|
|
72
|
+
getLatestHandle: {
|
|
73
|
+
methodKind: "unary";
|
|
74
|
+
input: typeof GetLatestHandleRequestSchema;
|
|
75
|
+
output: typeof GetLatestHandleResponseSchema;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import { file_inco_shield_v2_types } from "./types_pb.js";
|
|
3
|
+
export const file_inco_shield_v2_conductor = fileDesc("Ch5pbmNvL3NoaWVsZC92Mi9jb25kdWN0b3IucHJvdG8SDmluY28uc2hpZWxkLnYyIhgKFkdldExhdGVzdEhhbmRsZVJlcXVlc3QiQQoXR2V0TGF0ZXN0SGFuZGxlUmVzcG9uc2USJgoGaGFuZGxlGAEgASgLMhYuaW5jby5zaGllbGQudjIuSGFuZGxlMqoJChBDb25kdWN0b3JTZXJ2aWNlEk0KBURyYWZ0EiEuaW5jby5zaGllbGQudjIuRW5jcnlwdGVkRW52ZWxvcGUaIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRSZXNwb25zZRJOCgZQZXJtaXQSIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRFbnZlbG9wZRohLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZFJlc3BvbnNlElIKCkdldEJhbGFuY2USIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRFbnZlbG9wZRohLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZFJlc3BvbnNlElQKDEdldFBvcnRmb2xpbxIhLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZEVudmVsb3BlGiEuaW5jby5zaGllbGQudjIuRW5jcnlwdGVkUmVzcG9uc2USWQoRR2V0QmFsYW5jZUhpc3RvcnkSIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRFbnZlbG9wZRohLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZFJlc3BvbnNlElsKE0dldFBvcnRmb2xpb0hpc3RvcnkSIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRFbnZlbG9wZRohLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZFJlc3BvbnNlEmEKGVJlcXVlc3REZXBvc2l0QXR0ZXN0YXRpb24SIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRFbnZlbG9wZRohLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZFJlc3BvbnNlEl0KFUdldFBlcm1pc3Npb25zQnlPd25lchIhLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZEVudmVsb3BlGiEuaW5jby5zaGllbGQudjIuRW5jcnlwdGVkUmVzcG9uc2USXwoXR2V0UGVybWlzc2lvbnNCeVNwZW5kZXISIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRFbnZlbG9wZRohLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZFJlc3BvbnNlElwKFEdldFBlcm1pc3Npb25EZXRhaWxzEiEuaW5jby5zaGllbGQudjIuRW5jcnlwdGVkRW52ZWxvcGUaIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRSZXNwb25zZRJUCgxHZXRTcGVuZGFibGUSIS5pbmNvLnNoaWVsZC52Mi5FbmNyeXB0ZWRFbnZlbG9wZRohLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZFJlc3BvbnNlEloKEkdldE93bmVyR2VuZXJhdGlvbhIhLmluY28uc2hpZWxkLnYyLkVuY3J5cHRlZEVudmVsb3BlGiEuaW5jby5zaGllbGQudjIuRW5jcnlwdGVkUmVzcG9uc2USYgoPR2V0TGF0ZXN0SGFuZGxlEiYuaW5jby5zaGllbGQudjIuR2V0TGF0ZXN0SGFuZGxlUmVxdWVzdBonLmluY28uc2hpZWxkLnYyLkdldExhdGVzdEhhbmRsZVJlc3BvbnNlYgZwcm90bzM", [file_inco_shield_v2_types]);
|
|
4
|
+
export const GetLatestHandleRequestSchema = messageDesc(file_inco_shield_v2_conductor, 0);
|
|
5
|
+
export const GetLatestHandleResponseSchema = messageDesc(file_inco_shield_v2_conductor, 1);
|
|
6
|
+
export const ConductorService = serviceDesc(file_inco_shield_v2_conductor, 0);
|
|
@@ -1,103 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @generated from field: inco.shield.v2.Address recipient = 1;
|
|
14
|
-
*/
|
|
15
|
-
recipient?: Address;
|
|
16
|
-
/**
|
|
17
|
-
* The asset adapter address (20 bytes, encoded as an Address).
|
|
18
|
-
*
|
|
19
|
-
* @generated from field: inco.shield.v2.Address asset_adapter = 2;
|
|
20
|
-
*/
|
|
21
|
-
assetAdapter?: Address;
|
|
22
|
-
/**
|
|
23
|
-
* Asset identification data (e.g. abi.encode(tokenAddress)).
|
|
24
|
-
*
|
|
25
|
-
* @generated from field: bytes asset_identification_args = 3;
|
|
26
|
-
*/
|
|
27
|
-
assetIdentificationArgs: Uint8Array<ArrayBuffer>;
|
|
28
|
-
/**
|
|
29
|
-
* Optional memo.
|
|
30
|
-
*
|
|
31
|
-
* @generated from field: bytes memo = 4;
|
|
32
|
-
*/
|
|
33
|
-
memo: Uint8Array<ArrayBuffer>;
|
|
34
|
-
/**
|
|
35
|
-
* Optional escape hatch data.
|
|
36
|
-
*
|
|
37
|
-
* @generated from field: bytes escape_hatch = 5;
|
|
38
|
-
*/
|
|
39
|
-
escapeHatch: Uint8Array<ArrayBuffer>;
|
|
40
|
-
/**
|
|
41
|
-
* Symmetric key for AEAD-encrypting the response.
|
|
42
|
-
*
|
|
43
|
-
* @generated from field: bytes response_key = 6;
|
|
44
|
-
*/
|
|
45
|
-
responseKey: Uint8Array<ArrayBuffer>;
|
|
46
|
-
/**
|
|
47
|
-
* Depositor's EIP-712 signature over the DepositAttestationRequest digest
|
|
48
|
-
* (covers depositor, recipient, asset_adapter, asset_identification_args,
|
|
49
|
-
* memo, escape_hatch).
|
|
50
|
-
*
|
|
51
|
-
* @generated from field: bytes eip712_signature = 7;
|
|
52
|
-
*/
|
|
53
|
-
eip712Signature: Uint8Array<ArrayBuffer>;
|
|
54
|
-
/**
|
|
55
|
-
* Depositor address (must match eip712_signature signer).
|
|
56
|
-
*
|
|
57
|
-
* @generated from field: inco.shield.v2.Address depositor = 9;
|
|
58
|
-
*/
|
|
59
|
-
depositor?: Address;
|
|
60
|
-
constructor(data?: PartialMessage<RequestDepositAttestationRequest>);
|
|
61
|
-
static readonly runtime: typeof proto3;
|
|
62
|
-
static readonly typeName = "inco.shield.v2.RequestDepositAttestationRequest";
|
|
63
|
-
static readonly fields: FieldList;
|
|
64
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RequestDepositAttestationRequest;
|
|
65
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RequestDepositAttestationRequest;
|
|
66
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RequestDepositAttestationRequest;
|
|
67
|
-
static equals(a: RequestDepositAttestationRequest | PlainMessage<RequestDepositAttestationRequest> | undefined, b: RequestDepositAttestationRequest | PlainMessage<RequestDepositAttestationRequest> | undefined): boolean;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* RequestDepositAttestationResponse returns the TEE-generated ciphertext and attestation signature.
|
|
71
|
-
* Serialized into an EncryptedResponse (AEAD-encrypted with the caller's response_key).
|
|
72
|
-
*
|
|
73
|
-
* @generated from message inco.shield.v2.RequestDepositAttestationResponse
|
|
74
|
-
*/
|
|
75
|
-
export declare class RequestDepositAttestationResponse extends Message<RequestDepositAttestationResponse> {
|
|
76
|
-
/**
|
|
77
|
-
* TEE signature over the DepositAttestation EIP-712 digest.
|
|
78
|
-
*
|
|
79
|
-
* @generated from field: bytes tee_signature = 1;
|
|
80
|
-
*/
|
|
81
|
-
teeSignature: Uint8Array<ArrayBuffer>;
|
|
82
|
-
/**
|
|
83
|
-
* Error message if the request failed.
|
|
84
|
-
*
|
|
85
|
-
* @generated from field: string error_message = 2;
|
|
86
|
-
*/
|
|
87
|
-
errorMessage: string;
|
|
88
|
-
/**
|
|
89
|
-
* TEE-generated AEAD-encrypted recipient address (the on-chain `Deposit.toCiphertext`),
|
|
90
|
-
* sealed under the quorum-shared enclave key with a fresh random nonce.
|
|
91
|
-
*
|
|
92
|
-
* @generated from field: bytes to_ciphertext = 3;
|
|
93
|
-
*/
|
|
94
|
-
toCiphertext: Uint8Array<ArrayBuffer>;
|
|
95
|
-
constructor(data?: PartialMessage<RequestDepositAttestationResponse>);
|
|
96
|
-
static readonly runtime: typeof proto3;
|
|
97
|
-
static readonly typeName = "inco.shield.v2.RequestDepositAttestationResponse";
|
|
98
|
-
static readonly fields: FieldList;
|
|
99
|
-
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RequestDepositAttestationResponse;
|
|
100
|
-
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RequestDepositAttestationResponse;
|
|
101
|
-
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RequestDepositAttestationResponse;
|
|
102
|
-
static equals(a: RequestDepositAttestationResponse | PlainMessage<RequestDepositAttestationResponse> | undefined, b: RequestDepositAttestationResponse | PlainMessage<RequestDepositAttestationResponse> | undefined): boolean;
|
|
103
|
-
}
|
|
1
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Address } from "./types_pb.js";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
export declare const file_inco_shield_v2_deposit: GenFile;
|
|
5
|
+
export type DepositAttestationRequest = Message<"inco.shield.v2.DepositAttestationRequest"> & {
|
|
6
|
+
recipient?: Address | undefined;
|
|
7
|
+
assetAdapter?: Address | undefined;
|
|
8
|
+
assetIdentificationArgs: Uint8Array;
|
|
9
|
+
memo: Uint8Array;
|
|
10
|
+
escapeHatch: Uint8Array;
|
|
11
|
+
};
|
|
12
|
+
export declare const DepositAttestationRequestSchema: GenMessage<DepositAttestationRequest>;
|