@ocap/tx-protocols 1.29.4 → 1.29.6
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/esm/execute.d.mts +5 -0
- package/esm/execute.mjs +61 -4
- package/esm/index.d.mts +737 -73
- package/esm/index.mjs +2 -1
- package/esm/pipes/write-ledger.d.mts +73 -0
- package/esm/pipes/write-ledger.mjs +97 -0
- package/esm/protocols/account/delegate.d.mts +52 -1
- package/esm/protocols/account/migrate.d.mts +15 -1
- package/esm/protocols/account/revoke-delegate.d.mts +14 -1
- package/esm/protocols/asset/acquire-v2.d.mts +39 -1
- package/esm/protocols/asset/acquire-v3.d.mts +43 -1
- package/esm/protocols/asset/calls/transfer-token.d.mts +4 -1
- package/esm/protocols/asset/calls/transfer.d.mts +4 -1
- package/esm/protocols/asset/consume.d.mts +14 -1
- package/esm/protocols/asset/create.d.mts +23 -1
- package/esm/protocols/asset/mint.d.mts +28 -1
- package/esm/protocols/asset/update.d.mts +15 -1
- package/esm/protocols/factory/create.d.mts +23 -1
- package/esm/protocols/governance/claim-stake.d.mts +24 -1
- package/esm/protocols/governance/return-stake.d.mts +20 -1
- package/esm/protocols/governance/revoke-stake.d.mts +20 -1
- package/esm/protocols/governance/slash-stake.d.mts +30 -1
- package/esm/protocols/governance/stake.d.mts +27 -1
- package/esm/protocols/rollup/claim-reward.d.mts +57 -1
- package/esm/protocols/rollup/close.d.mts +16 -1
- package/esm/protocols/rollup/create-block.d.mts +42 -1
- package/esm/protocols/rollup/create.d.mts +28 -1
- package/esm/protocols/rollup/join.d.mts +18 -1
- package/esm/protocols/rollup/leave.d.mts +16 -1
- package/esm/protocols/rollup/migrate.d.mts +11 -1
- package/esm/protocols/rollup/pause.d.mts +11 -1
- package/esm/protocols/rollup/resume.d.mts +11 -1
- package/esm/protocols/rollup/update.d.mts +11 -1
- package/esm/protocols/token/create.d.mts +14 -1
- package/esm/protocols/token/deposit-v2.d.mts +23 -1
- package/esm/protocols/token/withdraw-v2.d.mts +33 -1
- package/esm/protocols/token-factory/burn.d.mts +29 -1
- package/esm/protocols/token-factory/create.d.mts +16 -1
- package/esm/protocols/token-factory/mint.d.mts +27 -1
- package/esm/protocols/token-factory/update.d.mts +15 -1
- package/esm/protocols/trade/exchange-v2.d.mts +40 -1
- package/esm/protocols/trade/transfer-v2.d.mts +32 -1
- package/esm/protocols/trade/transfer-v3.d.mts +31 -1
- package/esm/util.d.mts +1 -1
- package/lib/execute.cjs +61 -4
- package/lib/execute.d.cts +5 -0
- package/lib/index.cjs +2 -0
- package/lib/index.d.cts +737 -73
- package/lib/pipes/write-ledger.cjs +102 -0
- package/lib/pipes/write-ledger.d.cts +73 -0
- package/lib/protocols/account/delegate.d.cts +52 -1
- package/lib/protocols/account/migrate.d.cts +15 -1
- package/lib/protocols/account/revoke-delegate.d.cts +14 -1
- package/lib/protocols/asset/acquire-v2.d.cts +39 -1
- package/lib/protocols/asset/acquire-v3.d.cts +43 -1
- package/lib/protocols/asset/calls/transfer-token.d.cts +4 -1
- package/lib/protocols/asset/calls/transfer.d.cts +4 -1
- package/lib/protocols/asset/consume.d.cts +14 -1
- package/lib/protocols/asset/create.d.cts +23 -1
- package/lib/protocols/asset/mint.d.cts +28 -1
- package/lib/protocols/asset/update.d.cts +15 -1
- package/lib/protocols/factory/create.d.cts +23 -1
- package/lib/protocols/governance/claim-stake.d.cts +24 -1
- package/lib/protocols/governance/return-stake.d.cts +20 -1
- package/lib/protocols/governance/revoke-stake.d.cts +20 -1
- package/lib/protocols/governance/slash-stake.d.cts +30 -1
- package/lib/protocols/governance/stake.d.cts +27 -1
- package/lib/protocols/rollup/claim-reward.d.cts +57 -1
- package/lib/protocols/rollup/close.d.cts +16 -1
- package/lib/protocols/rollup/create-block.d.cts +42 -1
- package/lib/protocols/rollup/create.d.cts +28 -1
- package/lib/protocols/rollup/join.d.cts +18 -1
- package/lib/protocols/rollup/leave.d.cts +16 -1
- package/lib/protocols/rollup/migrate.d.cts +11 -1
- package/lib/protocols/rollup/pause.d.cts +11 -1
- package/lib/protocols/rollup/resume.d.cts +11 -1
- package/lib/protocols/rollup/update.d.cts +11 -1
- package/lib/protocols/token/create.d.cts +14 -1
- package/lib/protocols/token/deposit-v2.d.cts +23 -1
- package/lib/protocols/token/withdraw-v2.d.cts +33 -1
- package/lib/protocols/token-factory/burn.d.cts +29 -1
- package/lib/protocols/token-factory/create.d.cts +16 -1
- package/lib/protocols/token-factory/mint.d.cts +27 -1
- package/lib/protocols/token-factory/update.d.cts +15 -1
- package/lib/protocols/trade/exchange-v2.d.cts +40 -1
- package/lib/protocols/trade/transfer-v2.d.cts +32 -1
- package/lib/protocols/trade/transfer-v3.d.cts +31 -1
- package/lib/util.d.cts +2 -2
- package/package.json +20 -19
package/esm/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WriteLedger } from "./pipes/write-ledger.mjs";
|
|
1
2
|
import execute_default from "./execute.mjs";
|
|
2
3
|
import delegate_default from "./protocols/account/delegate.mjs";
|
|
3
4
|
import migrate_default from "./protocols/account/migrate.mjs";
|
|
@@ -97,4 +98,4 @@ const { execute } = defaultExecutor;
|
|
|
97
98
|
var src_default = defaultExecutor;
|
|
98
99
|
|
|
99
100
|
//#endregion
|
|
100
|
-
export { createExecutor, src_default as default, execute };
|
|
101
|
+
export { WriteLedger, createExecutor, src_default as default, execute };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { PipeFunction } from "@ocap/tx-pipeline";
|
|
2
|
+
import { ILedger } from "@ocap/types";
|
|
3
|
+
|
|
4
|
+
//#region src/pipes/write-ledger.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Context with ledger support
|
|
8
|
+
*/
|
|
9
|
+
interface IWriteLedgerContext {
|
|
10
|
+
/** VLedger instance (optional - skipped if not configured) */
|
|
11
|
+
ledger?: ILedger;
|
|
12
|
+
/** Transaction hash */
|
|
13
|
+
txHash: string;
|
|
14
|
+
/** Transaction type */
|
|
15
|
+
txType: string;
|
|
16
|
+
/** Raw transaction (base64) */
|
|
17
|
+
txBase64?: string;
|
|
18
|
+
/** Decoded transaction */
|
|
19
|
+
tx?: {
|
|
20
|
+
from?: string;
|
|
21
|
+
nonce?: number;
|
|
22
|
+
pk?: string;
|
|
23
|
+
signature?: string;
|
|
24
|
+
chainId?: string;
|
|
25
|
+
};
|
|
26
|
+
/** Chain ID from config */
|
|
27
|
+
config?: {
|
|
28
|
+
chainId?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Transaction time (ISO string from DecodeTx pipe) */
|
|
31
|
+
txTime?: string;
|
|
32
|
+
/** Ledger sequence number (set after successful write) */
|
|
33
|
+
ledgerSequence?: number;
|
|
34
|
+
/** Logger */
|
|
35
|
+
logger?: {
|
|
36
|
+
debug: (msg: string, meta?: Record<string, unknown>) => void;
|
|
37
|
+
error: (msg: string, meta?: Record<string, unknown>) => void;
|
|
38
|
+
};
|
|
39
|
+
/** Extended context (passkey verification, gas staking headers, etc.) */
|
|
40
|
+
extra?: {
|
|
41
|
+
/** Passkey verification data */
|
|
42
|
+
txExtra?: Record<string, unknown>;
|
|
43
|
+
/** Gas staking signature headers */
|
|
44
|
+
gasStakeHeaders?: {
|
|
45
|
+
token: string;
|
|
46
|
+
pk: string;
|
|
47
|
+
};
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Error codes for ledger write failures
|
|
53
|
+
*/
|
|
54
|
+
declare const LEDGER_ERRORS: {
|
|
55
|
+
readonly WRITE_FAILED: "LEDGER_WRITE_FAILED";
|
|
56
|
+
readonly NOT_INITIALIZED: "LEDGER_NOT_INITIALIZED";
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Create a WriteLedger pipe function
|
|
60
|
+
*
|
|
61
|
+
* @returns Pipe function that writes verified tx to ledger
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { WriteLedger } from '@ocap/tx-protocols/pipes/write-ledger';
|
|
66
|
+
*
|
|
67
|
+
* // In pipeline setup (after VerifySignature):
|
|
68
|
+
* runner.use(WriteLedger);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare const WriteLedger: PipeFunction<IWriteLedgerContext>;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { LEDGER_ERRORS, WriteLedger, WriteLedger as default };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import Debug from "debug";
|
|
2
|
+
import { formatMessage } from "@ocap/message";
|
|
3
|
+
|
|
4
|
+
//#region src/pipes/write-ledger.ts
|
|
5
|
+
/**
|
|
6
|
+
* WriteLedger Pipe
|
|
7
|
+
*
|
|
8
|
+
* Writes verified transactions to the Ledger append-only log.
|
|
9
|
+
* Must be placed AFTER VerifySignature to ensure only authenticated txs are recorded.
|
|
10
|
+
*
|
|
11
|
+
* The ledger provides:
|
|
12
|
+
* - Append-only immutable transaction log
|
|
13
|
+
* - Merkle tree proofs for auditability
|
|
14
|
+
* - Checkpoint mechanism for consistency
|
|
15
|
+
*
|
|
16
|
+
* NOTE: Ledger write failures will abort the pipeline to ensure data integrity.
|
|
17
|
+
*/
|
|
18
|
+
const debug = Debug("@ocap/tx-protocols:pipes:write-ledger");
|
|
19
|
+
/**
|
|
20
|
+
* Error codes for ledger write failures
|
|
21
|
+
*/
|
|
22
|
+
const LEDGER_ERRORS = {
|
|
23
|
+
WRITE_FAILED: "LEDGER_WRITE_FAILED",
|
|
24
|
+
NOT_INITIALIZED: "LEDGER_NOT_INITIALIZED"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Create a WriteLedger pipe function
|
|
28
|
+
*
|
|
29
|
+
* @returns Pipe function that writes verified tx to ledger
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { WriteLedger } from '@ocap/tx-protocols/pipes/write-ledger';
|
|
34
|
+
*
|
|
35
|
+
* // In pipeline setup (after VerifySignature):
|
|
36
|
+
* runner.use(WriteLedger);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
const WriteLedger = async (context, next) => {
|
|
40
|
+
const { ledger, txHash, txType, txBase64, tx, config, txTime, extra } = context;
|
|
41
|
+
if (!ledger) {
|
|
42
|
+
debug("No ledger configured, skipping write", { txHash });
|
|
43
|
+
return next();
|
|
44
|
+
}
|
|
45
|
+
if (!txHash || !txType || !txBase64 || !tx) {
|
|
46
|
+
debug("Missing required tx fields, skipping write", {
|
|
47
|
+
txHash,
|
|
48
|
+
txType
|
|
49
|
+
});
|
|
50
|
+
return next();
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
let txExtra;
|
|
54
|
+
if (extra?.txExtra || extra?.gasStakeHeaders) {
|
|
55
|
+
txExtra = {};
|
|
56
|
+
if (extra.txExtra) txExtra.txExtra = extra.txExtra;
|
|
57
|
+
if (extra.gasStakeHeaders) txExtra.gasStakeHeaders = extra.gasStakeHeaders;
|
|
58
|
+
}
|
|
59
|
+
const formattedTx = formatMessage("Transaction", tx);
|
|
60
|
+
const txInput = {
|
|
61
|
+
txRaw: txBase64,
|
|
62
|
+
tx: formattedTx,
|
|
63
|
+
txHash,
|
|
64
|
+
txType,
|
|
65
|
+
from: tx.from || "",
|
|
66
|
+
nonce: tx.nonce || 0,
|
|
67
|
+
pk: formattedTx.pk || "",
|
|
68
|
+
signature: formattedTx.signature || "",
|
|
69
|
+
chainId: tx.chainId || config?.chainId || "",
|
|
70
|
+
timestamp: txTime ? new Date(txTime).getTime() : Date.now(),
|
|
71
|
+
txExtra
|
|
72
|
+
};
|
|
73
|
+
const entry = await ledger.append(txInput);
|
|
74
|
+
context.ledgerSequence = entry.sequence;
|
|
75
|
+
debug("Transaction written to ledger", {
|
|
76
|
+
txHash,
|
|
77
|
+
sequence: entry.sequence,
|
|
78
|
+
entryHash: entry.entryHash
|
|
79
|
+
});
|
|
80
|
+
return next();
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
83
|
+
context.logger?.error("Failed to write tx to ledger", {
|
|
84
|
+
txHash,
|
|
85
|
+
error: message
|
|
86
|
+
});
|
|
87
|
+
debug("Ledger write failed", {
|
|
88
|
+
txHash,
|
|
89
|
+
error: message
|
|
90
|
+
});
|
|
91
|
+
return next(/* @__PURE__ */ new Error(`${LEDGER_ERRORS.WRITE_FAILED}: ${message}`));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var write_ledger_default = WriteLedger;
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { LEDGER_ERRORS, WriteLedger, write_ledger_default as default };
|
|
@@ -1,4 +1,55 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IReadyContext, IWithDelegation, IWithReceiver, IWithSender, TDelegateTx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/account/delegate.d.ts
|
|
2
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Context type for delegate protocol.
|
|
8
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
9
|
+
* Mixins: IWithSender, Partial<IWithReceiver>, Partial<IWithDelegation>
|
|
10
|
+
*/
|
|
11
|
+
type Context = IReadyContext<TDelegateTx> & Partial<IWithSender> & Partial<IWithReceiver> & Partial<IWithDelegation> & {
|
|
12
|
+
/** Formatted itx from formatMessage */
|
|
13
|
+
formattedItx?: {
|
|
14
|
+
ops: Array<{
|
|
15
|
+
typeUrl: string;
|
|
16
|
+
limit?: {
|
|
17
|
+
tokens?: Array<{
|
|
18
|
+
rate?: {
|
|
19
|
+
anchor?: number;
|
|
20
|
+
};
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
assets?: Array<{
|
|
24
|
+
rate?: {
|
|
25
|
+
anchor?: number;
|
|
26
|
+
};
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
/** Validated itx after Joi validation */
|
|
34
|
+
validatedItx?: {
|
|
35
|
+
opsList: Array<{
|
|
36
|
+
limit: {
|
|
37
|
+
tokensList: Array<{
|
|
38
|
+
txCount?: number;
|
|
39
|
+
txAllowance?: string;
|
|
40
|
+
totalAllowance?: string;
|
|
41
|
+
validUntil?: number;
|
|
42
|
+
rate?: unknown;
|
|
43
|
+
}>;
|
|
44
|
+
assetsList: Array<{
|
|
45
|
+
txCount?: number;
|
|
46
|
+
validUntil?: number;
|
|
47
|
+
rate?: unknown;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
declare const runner: Runner<Context>;
|
|
3
54
|
//#endregion
|
|
4
55
|
export { runner as default };
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IAccountState, IReadyContext, IWithSender, TAccountMigrateTx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/account/migrate.d.ts
|
|
2
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Context type for account_migrate protocol.
|
|
8
|
+
*
|
|
9
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
10
|
+
* Mixins: Partial<IWithSender> - sender may not exist for new accounts
|
|
11
|
+
*/
|
|
12
|
+
type Context = IReadyContext<TAccountMigrateTx> & Partial<IWithSender> & {
|
|
13
|
+
/** Receiver state - created during business logic */
|
|
14
|
+
receiverState?: IAccountState;
|
|
15
|
+
};
|
|
16
|
+
declare const runner: Runner<Context>;
|
|
3
17
|
//#endregion
|
|
4
18
|
export { runner as default };
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IReadyContext, IWithDelegation, IWithSender, TRevokeDelegateTx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/account/revoke-delegate.d.ts
|
|
2
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Context type for revoke-delegate protocol.
|
|
8
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
9
|
+
* Mixins: IWithSender (required), IWithDelegation (required)
|
|
10
|
+
*/
|
|
11
|
+
type Context = IReadyContext<TRevokeDelegateTx> & IWithSender & IWithDelegation & {
|
|
12
|
+
/** Type URLs to revoke from delegation */
|
|
13
|
+
typeUrls?: string[];
|
|
14
|
+
};
|
|
15
|
+
declare const runner: Runner<Context>;
|
|
3
16
|
//#endregion
|
|
4
17
|
export { runner as default };
|
|
@@ -1,9 +1,47 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IAccountState, IAssetFactoryState, IAssetState, IReadyContext, ITokenState, IWithAsset, IWithDelegation, IWithDelegator, IWithFactory, IWithOwner, IWithSender, TAcquireAssetV2Tx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/asset/acquire-v2.d.ts
|
|
2
5
|
/** Token input type */
|
|
3
6
|
interface TokenInput {
|
|
4
7
|
address: string;
|
|
5
8
|
value: string;
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Context type for acquire-asset-v2 protocol.
|
|
12
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
13
|
+
* Mixins: IWithSender, IWithDelegator, IWithFactory, IWithOwner, IWithAsset, IWithDelegation
|
|
14
|
+
*/
|
|
15
|
+
type Context = IReadyContext<TAcquireAssetV2Tx> & Partial<IWithSender> & Partial<IWithDelegator> & Partial<IWithFactory> & Partial<IWithOwner> & Partial<IWithAsset> & Partial<IWithDelegation> & {
|
|
16
|
+
/** Duplicate asset state if exists */
|
|
17
|
+
duplicateAsset?: IAssetState;
|
|
18
|
+
/** Factory owner state */
|
|
19
|
+
factoryOwnerState?: IAccountState;
|
|
20
|
+
/** Trusted issuer states from factory */
|
|
21
|
+
issuerStates?: IAccountState[];
|
|
22
|
+
/** Issuer state from itx */
|
|
23
|
+
issuerState?: IAccountState;
|
|
24
|
+
/** Asset states from itx.assetsList */
|
|
25
|
+
assetStates?: IAssetState[];
|
|
26
|
+
/** Expected factory states for input assets */
|
|
27
|
+
expectedFactoryStates?: IAssetFactoryState[];
|
|
28
|
+
/** Token addresses from factory input */
|
|
29
|
+
tokenAddress?: string[];
|
|
30
|
+
/** Token states for factory input tokens */
|
|
31
|
+
tokenStates?: ITokenState[];
|
|
32
|
+
/** Factory token inputs */
|
|
33
|
+
factoryTokens?: TokenInput[];
|
|
34
|
+
/** Asset owner state (buyer) */
|
|
35
|
+
assetOwner?: IAccountState;
|
|
36
|
+
/** Whether delegation was changed */
|
|
37
|
+
isDelegationChanged?: boolean;
|
|
38
|
+
/** Minted asset data */
|
|
39
|
+
mintedAsset?: Record<string, unknown>;
|
|
40
|
+
/** Minted asset address */
|
|
41
|
+
mintedAddress?: string;
|
|
42
|
+
/** Token updates for factory (non-instant settlement) */
|
|
43
|
+
tokenUpdates?: Record<string, string>;
|
|
44
|
+
};
|
|
45
|
+
declare const runner: Runner<Context>;
|
|
8
46
|
//#endregion
|
|
9
47
|
export { TokenInput, runner as default };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IAccountState, IAssetFactoryState, IAssetState, IReadyContext, ITokenState, IWithAsset, IWithFactory, IWithOwner, IWithReceiver, IWithSender, IWithSigners, TAcquireAssetV3Tx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/asset/acquire-v3.d.ts
|
|
2
5
|
/** Token input type */
|
|
3
6
|
interface TokenInput {
|
|
@@ -12,6 +15,45 @@ interface MultiInput {
|
|
|
12
15
|
assetsList?: string[];
|
|
13
16
|
assets?: string[];
|
|
14
17
|
}
|
|
15
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Context type for acquire-asset-v3 protocol.
|
|
20
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
21
|
+
* Mixins: IWithSender, IWithSigners, IWithFactory, IWithOwner, IWithReceiver, IWithAsset
|
|
22
|
+
*/
|
|
23
|
+
type Context = IReadyContext<TAcquireAssetV3Tx> & Partial<IWithSender> & Partial<IWithSigners> & Partial<IWithFactory> & Partial<IWithOwner> & Partial<IWithReceiver> & Partial<IWithAsset> & {
|
|
24
|
+
/** Duplicate asset state if exists */
|
|
25
|
+
duplicateAsset?: IAssetState;
|
|
26
|
+
/** Parsed inputs from itx */
|
|
27
|
+
inputs?: MultiInput[];
|
|
28
|
+
/** Sender addresses from inputs */
|
|
29
|
+
senders?: string[];
|
|
30
|
+
/** Token addresses from inputs */
|
|
31
|
+
tokens?: string[];
|
|
32
|
+
/** Asset addresses from inputs */
|
|
33
|
+
assets?: string[];
|
|
34
|
+
/** Token addresses from factory input */
|
|
35
|
+
tokenAddress?: string[];
|
|
36
|
+
/** Factory owner state */
|
|
37
|
+
factoryOwnerState?: IAccountState;
|
|
38
|
+
/** Trusted issuer states from factory */
|
|
39
|
+
issuerStates?: IAccountState[];
|
|
40
|
+
/** Issuer state from itx */
|
|
41
|
+
issuerState?: IAccountState;
|
|
42
|
+
/** Factory token inputs */
|
|
43
|
+
factoryTokens?: TokenInput[];
|
|
44
|
+
/** Token states for input tokens */
|
|
45
|
+
tokenStates?: ITokenState[];
|
|
46
|
+
/** Asset states from itx inputs */
|
|
47
|
+
assetStates?: IAssetState[];
|
|
48
|
+
/** Expected factory states for input assets */
|
|
49
|
+
expectedFactoryStates?: IAssetFactoryState[];
|
|
50
|
+
/** Minted asset data */
|
|
51
|
+
mintedAsset?: Record<string, unknown>;
|
|
52
|
+
/** Minted asset address */
|
|
53
|
+
mintedAddress?: string;
|
|
54
|
+
/** Token updates for factory (non-instant settlement) */
|
|
55
|
+
tokenUpdates?: Record<string, string>;
|
|
56
|
+
};
|
|
57
|
+
declare const runner: Runner<Context>;
|
|
16
58
|
//#endregion
|
|
17
59
|
export { MultiInput, TokenInput, runner as default };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IBaseContext } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/asset/calls/transfer-token.d.ts
|
|
2
|
-
declare const runner:
|
|
5
|
+
declare const runner: Runner<IBaseContext<unknown>>;
|
|
3
6
|
//#endregion
|
|
4
7
|
export { runner as default };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IBaseContext } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/asset/calls/transfer.d.ts
|
|
2
|
-
declare const runner:
|
|
5
|
+
declare const runner: Runner<IBaseContext<unknown>>;
|
|
3
6
|
//#endregion
|
|
4
7
|
export { runner as default };
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IReadyContext, IWithAsset, IWithIssuer, IWithOwner, IWithSender, IWithSigners, TConsumeAssetTx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/asset/consume.d.ts
|
|
2
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Context type for consume-asset protocol.
|
|
8
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
9
|
+
* Mixins: IWithAsset, IWithSender, IWithIssuer, IWithOwner, IWithSigners (all required)
|
|
10
|
+
*/
|
|
11
|
+
type Context = IReadyContext<TConsumeAssetTx> & IWithAsset & IWithSender & IWithIssuer & IWithOwner & IWithSigners & {
|
|
12
|
+
/** Signer addresses (owner + issuer) */
|
|
13
|
+
signers: string[];
|
|
14
|
+
};
|
|
15
|
+
declare const runner: Runner<Context>;
|
|
3
16
|
//#endregion
|
|
4
17
|
export { runner as default };
|
|
@@ -1,4 +1,26 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { AnyData } from "@ocap/message";
|
|
3
|
+
import { IAssetFactoryState, IAssetState, IReadyContext, IWithAsset, IWithDelegation, IWithDelegator, IWithIssuer, IWithSender, TCreateAssetTx } from "@ocap/types";
|
|
4
|
+
|
|
1
5
|
//#region src/protocols/asset/create.d.ts
|
|
2
|
-
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context type for create-asset protocol.
|
|
9
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
10
|
+
* Mixins: IWithSender, IWithIssuer, IWithDelegator, IWithDelegation (all optional as states may not exist)
|
|
11
|
+
*/
|
|
12
|
+
type Context = IReadyContext<TCreateAssetTx> & Partial<IWithSender> & Partial<IWithIssuer> & Partial<IWithDelegator> & Partial<IWithDelegation> & Partial<IWithAsset> & {
|
|
13
|
+
/** Decoded asset data from itx */
|
|
14
|
+
assetData?: AnyData | null;
|
|
15
|
+
/** Signer addresses (issuer) */
|
|
16
|
+
signers?: string[];
|
|
17
|
+
/** Factory state if parent is a factory */
|
|
18
|
+
factoryState?: IAssetFactoryState;
|
|
19
|
+
/** Parent asset state */
|
|
20
|
+
parentAsset?: IAssetState;
|
|
21
|
+
/** Whether delegation was changed during tx */
|
|
22
|
+
isDelegationChanged?: boolean;
|
|
23
|
+
};
|
|
24
|
+
declare const runner: Runner<Context>;
|
|
3
25
|
//#endregion
|
|
4
26
|
export { runner as default };
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IAccountState, IAssetFactoryState, IAssetState, IReadyContext, IWithFactory, IWithOwner, IWithReceiver, IWithSender, TMintAssetTx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/asset/mint.d.ts
|
|
2
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Context type for mint-asset protocol.
|
|
8
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
9
|
+
* Mixins: IWithSender, IWithFactory, IWithOwner, IWithReceiver
|
|
10
|
+
*/
|
|
11
|
+
type Context = IReadyContext<TMintAssetTx> & Partial<IWithSender> & Partial<IWithFactory> & Partial<IWithOwner> & Partial<IWithReceiver> & {
|
|
12
|
+
/** Duplicate asset state if exists */
|
|
13
|
+
duplicateAsset?: IAssetState;
|
|
14
|
+
/** Factory owner state */
|
|
15
|
+
factoryOwnerState?: IAccountState;
|
|
16
|
+
/** Trusted issuer states from factory */
|
|
17
|
+
issuerStates?: IAccountState[];
|
|
18
|
+
/** Asset states from itx.assetsList */
|
|
19
|
+
assetStates?: IAssetState[];
|
|
20
|
+
/** Expected factory states for input assets */
|
|
21
|
+
expectedFactoryStates?: IAssetFactoryState[];
|
|
22
|
+
/** Minted asset data */
|
|
23
|
+
mintedAsset?: Record<string, unknown>;
|
|
24
|
+
/** Minted asset address */
|
|
25
|
+
mintedAddress?: string;
|
|
26
|
+
/** Owner address (resolved) */
|
|
27
|
+
ownerAddress?: string;
|
|
28
|
+
};
|
|
29
|
+
declare const runner: Runner<Context>;
|
|
3
30
|
//#endregion
|
|
4
31
|
export { runner as default };
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { AnyData } from "@ocap/message";
|
|
3
|
+
import { IReadyContext, IWithAsset, IWithIssuer, IWithSender, TUpdateAssetTx } from "@ocap/types";
|
|
4
|
+
|
|
1
5
|
//#region src/protocols/asset/update.d.ts
|
|
2
|
-
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context type for update-asset protocol.
|
|
9
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
10
|
+
* Mixins: IWithAsset (required), IWithSender (required), IWithIssuer (optional)
|
|
11
|
+
*/
|
|
12
|
+
type Context = IReadyContext<TUpdateAssetTx> & IWithAsset & IWithSender & Partial<IWithIssuer> & {
|
|
13
|
+
/** Decoded new data for asset update, null means no update */
|
|
14
|
+
newData: AnyData | null;
|
|
15
|
+
};
|
|
16
|
+
declare const runner: Runner<Context>;
|
|
3
17
|
//#endregion
|
|
4
18
|
export { runner as default };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
2
|
+
import { IAccountState, IAssetFactoryState, IAssetState, IReadyContext, ITokenState, IWithDelegation, IWithDelegator, IWithFactory, IWithSender, TCreateFactoryTx } from "@ocap/types";
|
|
3
|
+
|
|
1
4
|
//#region src/protocols/factory/create.d.ts
|
|
2
5
|
/** Formatted factory properties from formatMessage */
|
|
3
6
|
interface FormattedFactoryProps {
|
|
@@ -24,6 +27,25 @@ interface FormattedFactoryProps {
|
|
|
24
27
|
display?: unknown;
|
|
25
28
|
data?: unknown;
|
|
26
29
|
}
|
|
27
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Context type for create-factory protocol.
|
|
32
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
33
|
+
* Mixins: IWithSender, IWithDelegator, IWithDelegation, IWithFactory
|
|
34
|
+
*/
|
|
35
|
+
type Context = IReadyContext<TCreateFactoryTx> & Partial<IWithSender> & Partial<IWithDelegator> & Partial<IWithDelegation> & Partial<IWithFactory> & {
|
|
36
|
+
/** Formatted factory props from formatMessage */
|
|
37
|
+
factoryProps?: FormattedFactoryProps;
|
|
38
|
+
/** Token states for factory input tokens */
|
|
39
|
+
tokenStates?: ITokenState[];
|
|
40
|
+
/** Asset states for factory input assets */
|
|
41
|
+
inputAssetStates?: IAssetState[];
|
|
42
|
+
/** Factory states for factory input assets (that are factories) */
|
|
43
|
+
inputFactoryStates?: IAssetFactoryState[];
|
|
44
|
+
/** Trusted issuer states */
|
|
45
|
+
issuerStates?: IAccountState[];
|
|
46
|
+
/** Whether delegation was changed */
|
|
47
|
+
isDelegationChanged?: boolean;
|
|
48
|
+
};
|
|
49
|
+
declare const runner: Runner<Context>;
|
|
28
50
|
//#endregion
|
|
29
51
|
export { FormattedFactoryProps, runner as default };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
1
2
|
import { BN } from "@ocap/util";
|
|
3
|
+
import { IReadyContext, ITxState, IWithAssets, IWithEvidence, IWithReceivers, IWithSender, IWithStake, IWithTokens, TClaimStakeTx } from "@ocap/types";
|
|
2
4
|
|
|
3
5
|
//#region src/protocols/governance/claim-stake.d.ts
|
|
4
6
|
/** Token input type */
|
|
@@ -22,6 +24,27 @@ interface TokenCondition {
|
|
|
22
24
|
value: BN;
|
|
23
25
|
}>;
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Context type for claim-stake protocol.
|
|
29
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
30
|
+
* Mixins: IWithSender, IWithStake, IWithEvidence, IWithReceivers, IWithTokens, IWithAssets
|
|
31
|
+
*/
|
|
32
|
+
type Context = IReadyContext<TClaimStakeTx> & IWithSender & IWithStake & Partial<IWithEvidence> & Partial<IWithReceivers> & Partial<IWithTokens> & Partial<IWithAssets> & {
|
|
33
|
+
/** Transaction state for evidence */
|
|
34
|
+
txState?: ITxState;
|
|
35
|
+
/** Parsed outputs from evidence tx */
|
|
36
|
+
outputs?: MultiOutput[];
|
|
37
|
+
/** Receiver addresses from outputs */
|
|
38
|
+
receivers?: string[];
|
|
39
|
+
/** Token addresses from outputs */
|
|
40
|
+
tokens?: string[];
|
|
41
|
+
/** Asset addresses from outputs */
|
|
42
|
+
assets?: string[];
|
|
43
|
+
/** Token condition for balance verification */
|
|
44
|
+
tokenCondition?: TokenCondition;
|
|
45
|
+
/** Revoked tokens to claim */
|
|
46
|
+
revokedTokens?: TokenInput[];
|
|
47
|
+
};
|
|
48
|
+
declare const runner: Runner<Context>;
|
|
26
49
|
//#endregion
|
|
27
50
|
export { MultiOutput, TokenCondition, TokenInput, runner as default };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
1
2
|
import { BN } from "@ocap/util";
|
|
3
|
+
import { IReadyContext, IWithAssets, IWithLocked, IWithReceivers, IWithSender, IWithStake, IWithTokens, TReturnStakeTx } from "@ocap/types";
|
|
2
4
|
|
|
3
5
|
//#region src/protocols/governance/return-stake.d.ts
|
|
4
6
|
/** Token input type */
|
|
@@ -22,6 +24,23 @@ interface TokenCondition {
|
|
|
22
24
|
value: BN;
|
|
23
25
|
}>;
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Context type for return-stake protocol.
|
|
29
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
30
|
+
* Mixins: IWithSender, IWithReceivers, IWithStake, IWithTokens, IWithAssets, IWithLocked
|
|
31
|
+
*/
|
|
32
|
+
type Context = IReadyContext<TReturnStakeTx> & IWithSender & IWithStake & Partial<IWithReceivers> & Partial<IWithTokens> & Partial<IWithAssets> & Partial<IWithLocked> & {
|
|
33
|
+
/** Parsed outputs from itx */
|
|
34
|
+
outputs?: MultiInput[];
|
|
35
|
+
/** Receiver addresses from outputs */
|
|
36
|
+
receivers?: string[];
|
|
37
|
+
/** Token addresses from outputs */
|
|
38
|
+
tokens?: string[];
|
|
39
|
+
/** Asset addresses from outputs */
|
|
40
|
+
assets?: string[];
|
|
41
|
+
/** Token condition for balance verification */
|
|
42
|
+
tokenCondition?: TokenCondition;
|
|
43
|
+
};
|
|
44
|
+
declare const runner: Runner<Context>;
|
|
26
45
|
//#endregion
|
|
27
46
|
export { MultiInput, TokenCondition, TokenInput, runner as default };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Runner } from "@ocap/tx-pipeline";
|
|
1
2
|
import { BN } from "@ocap/util";
|
|
3
|
+
import { IReadyContext, IWithAssets, IWithReceivers, IWithSender, IWithStake, IWithTokens, TRevokeStakeTx } from "@ocap/types";
|
|
2
4
|
|
|
3
5
|
//#region src/protocols/governance/revoke-stake.d.ts
|
|
4
6
|
/** Token input type */
|
|
@@ -22,6 +24,23 @@ interface TokenCondition {
|
|
|
22
24
|
value: BN;
|
|
23
25
|
}>;
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Context type for revoke-stake protocol.
|
|
29
|
+
* Phase: IReadyContext (after TakeStateSnapshot)
|
|
30
|
+
* Mixins: IWithSender, IWithStake, IWithReceivers, IWithTokens, IWithAssets
|
|
31
|
+
*/
|
|
32
|
+
type Context = IReadyContext<TRevokeStakeTx> & IWithSender & IWithStake & Partial<IWithReceivers> & Partial<IWithTokens> & Partial<IWithAssets> & {
|
|
33
|
+
/** Parsed outputs from itx */
|
|
34
|
+
outputs?: MultiOutput[];
|
|
35
|
+
/** Receiver addresses from outputs */
|
|
36
|
+
receivers?: string[];
|
|
37
|
+
/** Token addresses from outputs */
|
|
38
|
+
tokens?: string[];
|
|
39
|
+
/** Asset addresses from outputs */
|
|
40
|
+
assets?: string[];
|
|
41
|
+
/** Token condition for balance verification */
|
|
42
|
+
tokenCondition?: TokenCondition;
|
|
43
|
+
};
|
|
44
|
+
declare const runner: Runner<Context>;
|
|
26
45
|
//#endregion
|
|
27
46
|
export { MultiOutput, TokenCondition, TokenInput, runner as default };
|