@ocap/tx-protocols 1.31.5 → 1.31.7
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/bridge-release-crypto.mjs +1 -1
- package/esm/execute.mjs +24 -5
- package/esm/gas-security-guard.d.mts +2 -8
- package/esm/gas-security-guard.mjs +16 -1
- package/esm/index.d.mts +16 -3
- package/esm/index.mjs +0 -2
- package/esm/pipes/ensure-cost.mjs +3 -0
- package/esm/pipes/ensure-gas.d.mts +2 -1
- package/esm/pipes/write-ledger.mjs +2 -1
- package/esm/protocols/bridge/release-checks.d.mts +69 -0
- package/esm/protocols/bridge/{release.mjs → release-checks.mjs} +101 -100
- package/esm/protocols/rollup/bridge-create.mjs +2 -2
- package/esm/protocols/rollup/bridge-membership.mjs +10 -12
- package/esm/protocols/rollup/bridge-v2.d.mts +15 -5
- package/esm/protocols/rollup/bridge-v2.mjs +33 -8
- package/esm/protocols/token/deposit-v2.mjs +126 -25
- package/esm/protocols/token/withdraw-v2.d.mts +13 -1
- package/esm/protocols/token/withdraw-v2.mjs +158 -25
- package/esm/protocols/trade/transfer-v2.mjs +3 -8
- package/lib/bridge-release-crypto.cjs +1 -1
- package/lib/execute.cjs +24 -5
- package/lib/gas-security-guard.cjs +16 -1
- package/lib/gas-security-guard.d.cts +2 -8
- package/lib/index.cjs +0 -2
- package/lib/index.d.cts +16 -3
- package/lib/pipes/ensure-cost.cjs +3 -0
- package/lib/pipes/ensure-gas.d.cts +2 -1
- package/lib/pipes/write-ledger.cjs +2 -1
- package/lib/protocols/bridge/{release.cjs → release-checks.cjs} +115 -101
- package/lib/protocols/bridge/release-checks.d.cts +69 -0
- package/lib/protocols/rollup/bridge-create.cjs +1 -1
- package/lib/protocols/rollup/bridge-membership.cjs +9 -10
- package/lib/protocols/rollup/bridge-v2.cjs +32 -5
- package/lib/protocols/rollup/bridge-v2.d.cts +15 -5
- package/lib/protocols/token/deposit-v2.cjs +125 -24
- package/lib/protocols/token/withdraw-v2.cjs +155 -22
- package/lib/protocols/token/withdraw-v2.d.cts +13 -1
- package/lib/protocols/trade/transfer-v2.cjs +2 -7
- package/package.json +16 -16
- package/esm/protocols/bridge/release.d.mts +0 -34
- package/lib/protocols/bridge/release.d.cts +0 -34
package/lib/execute.cjs
CHANGED
|
@@ -17,6 +17,7 @@ let _arcblock_did_util = require("@arcblock/did-util");
|
|
|
17
17
|
let _arcblock_jwt = require("@arcblock/jwt");
|
|
18
18
|
_arcblock_jwt = require_rolldown_runtime.__toESM(_arcblock_jwt);
|
|
19
19
|
let _ocap_state = require("@ocap/state");
|
|
20
|
+
let _ocap_tx_pipeline_lib_bridge_reserves = require("@ocap/tx-pipeline/lib/bridge-reserves");
|
|
20
21
|
let _ocap_util = require("@ocap/util");
|
|
21
22
|
let _ocap_util_lib_get_related_addr = require("@ocap/util/lib/get-related-addr");
|
|
22
23
|
let lodash_camelCase = require("lodash/camelCase");
|
|
@@ -114,6 +115,12 @@ const NON_EXISTENT_SENDER_CAPABLE_TX_TYPES = new Set([
|
|
|
114
115
|
"deposit_token_v2",
|
|
115
116
|
"transfer_v3"
|
|
116
117
|
]);
|
|
118
|
+
/**
|
|
119
|
+
* #1692 (bridge/docs/deposit-withdraw-v2-unification.md §2.7 item 2): a `deposit_token_v2` with a bridge kind (1/2/3) is a
|
|
120
|
+
* bridge release, whose sender must exist and pay gas; only the v1 deposit (kind 0) keeps
|
|
121
|
+
* the non-existent sender capability. The kind is in the itx, so this needs no state.
|
|
122
|
+
*/
|
|
123
|
+
const isNonExistentSenderCapable = (shortTxType, itx) => NON_EXISTENT_SENDER_CAPABLE_TX_TYPES.has(shortTxType) && !(0, _ocap_tx_pipeline_lib_bridge_reserves.isBridgeRelease)(shortTxType, itx);
|
|
117
124
|
const shouldPersistTx = (err, context) => {
|
|
118
125
|
if (!err) return true;
|
|
119
126
|
if (!(0, lodash_get.default)(err, "props.persist")) return false;
|
|
@@ -269,6 +276,11 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
269
276
|
return result;
|
|
270
277
|
}
|
|
271
278
|
case "deposit_token_v2": {
|
|
279
|
+
if ((0, _ocap_tx_pipeline_lib_bridge_reserves.isBridgeRelease)(shortTxType, itx)) return {
|
|
280
|
+
create: 2,
|
|
281
|
+
update: 3,
|
|
282
|
+
isGasSelfStakeTx: false
|
|
283
|
+
};
|
|
272
284
|
const result = {
|
|
273
285
|
create: 2,
|
|
274
286
|
update: 1,
|
|
@@ -375,7 +387,7 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
375
387
|
const txType = context.txType;
|
|
376
388
|
const shortTxType = require_gas_security_guard.normalizeShortTxType(txType);
|
|
377
389
|
const assertProtocolAdmissibleWithoutSenderState = async () => {
|
|
378
|
-
if (!isExistingAssetSender && !
|
|
390
|
+
if (!isExistingAssetSender && !isNonExistentSenderCapable(shortTxType, context.itx)) throw new _ocap_util_lib_error.CustomError("INVALID_SENDER_STATE", `Invalid state extracted for ACCOUNT: ${from}`, { persist: false });
|
|
379
391
|
if (shortTxType === "transfer_v3" || shortTxType === "stake" || shortTxType === "burn_token" || shortTxType === "mint_token" || shortTxType === "acquire_asset_v3") {
|
|
380
392
|
const inputs = (0, _ocap_util_lib_get_list_field.getListField)(context.itx, "inputs") || [];
|
|
381
393
|
if ((shortTxType === "transfer_v3" || shortTxType === "stake" || shortTxType === "burn_token") && inputs.length === 0) throw new _ocap_util_lib_error.CustomError("INVALID_TX", "Invalid itx: inputs must not be empty", { persist: false });
|
|
@@ -383,7 +395,7 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
383
395
|
if (!inp?.owner) throw new _ocap_util_lib_error.CustomError("INVALID_TX", "Invalid itx: input owner is required", { persist: false });
|
|
384
396
|
if (!(Boolean(await accountStore.get(inp.owner, context)) || (0, _arcblock_did.toTypeInfo)(inp.owner).role === _ocap_mcrypto.types.RoleType.ROLE_ASSET && typeof statedb?.asset?.get === "function" && Boolean(await statedb.asset.get(inp.owner, context)))) throw new _ocap_util_lib_error.CustomError("INVALID_SIGNER_STATE", `Invalid state extracted for ACCOUNT: ${inp.owner}`, { persist: false });
|
|
385
397
|
}
|
|
386
|
-
} else if (shortTxType === "deposit_token_v2") {
|
|
398
|
+
} else if (shortTxType === "deposit_token_v2" && !(0, _ocap_tx_pipeline_lib_bridge_reserves.isBridgeRelease)(shortTxType, context.itx)) {
|
|
387
399
|
const signatures = (0, _ocap_util_lib_get_list_field.getListField)(context.tx, "signatures") || [];
|
|
388
400
|
if (signatures.length === 0) throw new _ocap_util_lib_error.CustomError("INVALID_TX", "itx.proposer must exist in signatures", { persist: false });
|
|
389
401
|
for (const sig of signatures) if (!sig?.signer || !await accountStore.get(sig.signer, context)) throw new _ocap_util_lib_error.CustomError("INVALID_SIGNER_STATE", `Invalid state extracted for ACCOUNT: ${sig?.signer || ""}`, { persist: false });
|
|
@@ -466,6 +478,7 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
466
478
|
const selfStakeInfo = isThirdPartyGasPass ? await resolveSelfGasStake() : null;
|
|
467
479
|
const selfStakeEligible = Boolean(selfStakeInfo?.valid) && require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
468
480
|
txType,
|
|
481
|
+
itx: context.itx,
|
|
469
482
|
txSize,
|
|
470
483
|
gasEstimate,
|
|
471
484
|
isFailedTxGasCharge: false,
|
|
@@ -474,12 +487,14 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
474
487
|
config
|
|
475
488
|
}).eligible;
|
|
476
489
|
const effectiveStakeState = selfStakeInfo?.valid && selfStakeEligible ? selfStakeInfo.state : passStakeState;
|
|
490
|
+
const effectiveThirdParty = selfStakeInfo?.valid && selfStakeEligible ? false : isThirdPartyGasPass;
|
|
477
491
|
const eligibility = require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
478
492
|
txType,
|
|
493
|
+
itx: context.itx,
|
|
479
494
|
txSize,
|
|
480
495
|
gasEstimate,
|
|
481
496
|
isFailedTxGasCharge: false,
|
|
482
|
-
isThirdPartySponsor:
|
|
497
|
+
isThirdPartySponsor: effectiveThirdParty,
|
|
483
498
|
enforceSponsor3DEligibility: false,
|
|
484
499
|
config
|
|
485
500
|
});
|
|
@@ -586,6 +601,7 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
586
601
|
const selfStakeInfo = await resolveSelfGasStake();
|
|
587
602
|
const selfStakeEligible = Boolean(selfStakeInfo.valid) && require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
588
603
|
txType,
|
|
604
|
+
itx: context.itx,
|
|
589
605
|
txSize,
|
|
590
606
|
gasEstimate,
|
|
591
607
|
isFailedTxGasCharge: false,
|
|
@@ -603,13 +619,15 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
603
619
|
return;
|
|
604
620
|
}
|
|
605
621
|
} else {
|
|
622
|
+
const enforceSponsor3DEligibility = decoded.enforce3DEligibility === true || (config?.transaction?.txGas)?.enforceSponsor3DEligibility === true;
|
|
606
623
|
const eligibility = require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
607
624
|
txType,
|
|
625
|
+
itx: context.itx,
|
|
608
626
|
txSize,
|
|
609
627
|
gasEstimate,
|
|
610
628
|
isFailedTxGasCharge: false,
|
|
611
629
|
isThirdPartySponsor: true,
|
|
612
|
-
enforceSponsor3DEligibility
|
|
630
|
+
enforceSponsor3DEligibility,
|
|
613
631
|
config
|
|
614
632
|
});
|
|
615
633
|
if (require_util.isGasStakeValid(sponsorStakeState, config) && eligibility.eligible) {
|
|
@@ -626,6 +644,7 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
626
644
|
if (require_util.isGasStakeValid(await statedb.stake.get(directStakeId, context), config)) {
|
|
627
645
|
if (require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
628
646
|
txType,
|
|
647
|
+
itx: context.itx,
|
|
629
648
|
txSize,
|
|
630
649
|
gasEstimate,
|
|
631
650
|
isFailedTxGasCharge: false,
|
|
@@ -641,7 +660,7 @@ const createExecute = ({ filter, runAsLambda }) => {
|
|
|
641
660
|
}
|
|
642
661
|
if (isExistingAssetSender) throw new _ocap_util_lib_error.CustomError("INSUFFICIENT_FUND", `Insufficient fund to pay for tx cost from ${from}`, { persist: false });
|
|
643
662
|
if (txType === "fg:t:account_migrate" || Boolean(token || pk) || Boolean(rawGasPass)) throw new _ocap_util_lib_error.CustomError("INVALID_GAS_PAYER", `Gas payer ${from} does not exist on chain`, { persist: false });
|
|
644
|
-
if (!
|
|
663
|
+
if (!isNonExistentSenderCapable(shortTxType, context.itx)) throw new _ocap_util_lib_error.CustomError("INVALID_SENDER_STATE", `Invalid state extracted for ACCOUNT: ${from}`, { persist: false });
|
|
645
664
|
throw new _ocap_util_lib_error.CustomError("INVALID_SENDER_STATE", `Invalid state extracted for ACCOUNT: ${from}`, { persist: false });
|
|
646
665
|
};
|
|
647
666
|
const assertSenderNonceFresh = async (context) => {
|
|
@@ -6,6 +6,7 @@ let _ocap_util_lib_get_list_field = require("@ocap/util/lib/get-list-field");
|
|
|
6
6
|
let _arcblock_did = require("@arcblock/did");
|
|
7
7
|
let _arcblock_did_util = require("@arcblock/did-util");
|
|
8
8
|
let _ocap_state = require("@ocap/state");
|
|
9
|
+
let _ocap_tx_pipeline_lib_bridge_reserves = require("@ocap/tx-pipeline/lib/bridge-reserves");
|
|
9
10
|
let _ocap_util = require("@ocap/util");
|
|
10
11
|
let lodash_cloneDeep = require("lodash/cloneDeep");
|
|
11
12
|
lodash_cloneDeep = require_rolldown_runtime.__toESM(lodash_cloneDeep);
|
|
@@ -208,8 +209,15 @@ function evaluateStakeForGasEligibility(params) {
|
|
|
208
209
|
};
|
|
209
210
|
const shortType = normalizeShortTxType(params.txType);
|
|
210
211
|
const customAllowlist = (params.config?.transaction?.txGas)?.freeGasAllowedTxTypes;
|
|
212
|
+
const isBridgeReleaseTx = (0, _ocap_tx_pipeline_lib_bridge_reserves.isBridgeRelease)(params.txType, params.itx);
|
|
213
|
+
if (isBridgeReleaseTx) {
|
|
214
|
+
if (!(Array.isArray(customAllowlist) && customAllowlist.some((t) => normalizeShortTxType(t) === BRIDGE_RELEASE_GAS_TYPE))) return {
|
|
215
|
+
eligible: false,
|
|
216
|
+
reason: "TX_TYPE_REQUIRES_DIRECT_GAS"
|
|
217
|
+
};
|
|
218
|
+
}
|
|
211
219
|
const enforceAllowlist = !params.isThirdPartySponsor || params.enforceSponsor3DEligibility === true;
|
|
212
|
-
if (shortType) {
|
|
220
|
+
if (shortType && !isBridgeReleaseTx) {
|
|
213
221
|
const requiresDirectGas = DIRECT_GAS_REQUIRED_TX_TYPES.has(shortType);
|
|
214
222
|
if (Array.isArray(customAllowlist) && customAllowlist.length > 0) {
|
|
215
223
|
if (!customAllowlist.some((t) => normalizeShortTxType(t) === shortType || t === params.txType) && (enforceAllowlist || requiresDirectGas)) return {
|
|
@@ -305,9 +313,16 @@ function extractTransactionTargets(tx, decodedItx, txType) {
|
|
|
305
313
|
* must be in `allowedTargets`.
|
|
306
314
|
* - `maxGasPerTx`: if present, `totalGas` must not exceed `maxGasPerTx`.
|
|
307
315
|
*/
|
|
316
|
+
/** Gas / resource name of a bridge release (`fg:t:deposit_token_v2_bridge` without the prefix). */
|
|
317
|
+
const BRIDGE_RELEASE_GAS_TYPE = "deposit_token_v2_bridge";
|
|
308
318
|
function verifyPaymasterConstraints(params) {
|
|
309
319
|
const { decoded, tx, itx, txType, totalGas } = params;
|
|
310
320
|
const isPaymasterDirectCharge = decoded.mode === "paymaster" || decoded.chargeSponsorBalance === true;
|
|
321
|
+
if ((0, _ocap_tx_pipeline_lib_bridge_reserves.isBridgeRelease)(txType, itx)) return {
|
|
322
|
+
valid: false,
|
|
323
|
+
reason: "PAYMASTER_TX_TYPE_FORBIDDEN",
|
|
324
|
+
isPaymasterDirectCharge
|
|
325
|
+
};
|
|
311
326
|
if (Array.isArray(decoded.allowedTxTypes)) {
|
|
312
327
|
if (decoded.allowedTxTypes.length === 0) return {
|
|
313
328
|
valid: false,
|
|
@@ -161,6 +161,8 @@ interface IStakeForGasEligibilityResult {
|
|
|
161
161
|
*/
|
|
162
162
|
declare function evaluateStakeForGasEligibility(params: {
|
|
163
163
|
txType?: string;
|
|
164
|
+
/** the decoded itx: a `deposit_token_v2` with a bridge kind is a bridge release (#1692), never gas-free */
|
|
165
|
+
itx?: unknown;
|
|
164
166
|
txSize?: number;
|
|
165
167
|
gasEstimate?: {
|
|
166
168
|
create?: number;
|
|
@@ -177,14 +179,6 @@ declare function evaluateStakeForGasEligibility(params: {
|
|
|
177
179
|
* Paymaster `allowedTargets` scoping.
|
|
178
180
|
*/
|
|
179
181
|
declare function extractTransactionTargets(tx: Record<string, unknown> | undefined, decodedItx?: Record<string, unknown> | undefined, txType?: string): string[];
|
|
180
|
-
/**
|
|
181
|
-
* Verifies Merchant / DApp Paymaster (`extra.gasStakeHeaders` JWT) scope constraints:
|
|
182
|
-
* - `allowedTxTypes`: if present, transaction type must be in `allowedTxTypes`.
|
|
183
|
-
* - `allowedTargets`: if present, transaction must touch at least one target and EVERY target
|
|
184
|
-
* touched by the transaction (excluding the sender `tx.from` itself in multi-input change)
|
|
185
|
-
* must be in `allowedTargets`.
|
|
186
|
-
* - `maxGasPerTx`: if present, `totalGas` must not exceed `maxGasPerTx`.
|
|
187
|
-
*/
|
|
188
182
|
declare function verifyPaymasterConstraints(params: {
|
|
189
183
|
decoded: IPaymasterDecodedClaims;
|
|
190
184
|
tx?: Record<string, unknown>;
|
package/lib/index.cjs
CHANGED
|
@@ -14,7 +14,6 @@ const require_protocols_asset_consume = require('./protocols/asset/consume.cjs')
|
|
|
14
14
|
const require_protocols_asset_create = require('./protocols/asset/create.cjs');
|
|
15
15
|
const require_protocols_asset_mint = require('./protocols/asset/mint.cjs');
|
|
16
16
|
const require_protocols_asset_update = require('./protocols/asset/update.cjs');
|
|
17
|
-
const require_protocols_bridge_release = require('./protocols/bridge/release.cjs');
|
|
18
17
|
const require_protocols_factory_create = require('./protocols/factory/create.cjs');
|
|
19
18
|
const require_protocols_governance_claim_stake = require('./protocols/governance/claim-stake.cjs');
|
|
20
19
|
const require_protocols_governance_return_stake = require('./protocols/governance/return-stake.cjs');
|
|
@@ -69,7 +68,6 @@ const createExecutor = ({ filter, runAsLambda }) => {
|
|
|
69
68
|
updateTokenFactory: require_protocols_token_factory_update.default,
|
|
70
69
|
mintToken: require_protocols_token_factory_mint.default,
|
|
71
70
|
burnToken: require_protocols_token_factory_burn.default,
|
|
72
|
-
releaseBridgeToken: require_protocols_bridge_release.default,
|
|
73
71
|
stake: require_protocols_governance_stake.default,
|
|
74
72
|
revokeStake: require_protocols_governance_revoke_stake.default,
|
|
75
73
|
claimStake: require_protocols_governance_claim_stake.default,
|
package/lib/index.d.cts
CHANGED
|
@@ -12,7 +12,6 @@ import { TokenInput as TokenInput$4 } from "./protocols/token/withdraw-v2.cjs";
|
|
|
12
12
|
import { TokenInfoForVerification } from "./protocols/token-factory/update.cjs";
|
|
13
13
|
import { MultiInput as MultiInput$2 } from "./protocols/token-factory/mint.cjs";
|
|
14
14
|
import { MultiInput as MultiInput$3 } from "./protocols/token-factory/burn.cjs";
|
|
15
|
-
import { Context } from "./protocols/bridge/release.cjs";
|
|
16
15
|
import { MultiInput as MultiInput$4 } from "./protocols/governance/stake.cjs";
|
|
17
16
|
import { MultiOutput, TokenCondition } from "./protocols/governance/revoke-stake.cjs";
|
|
18
17
|
import { MultiOutput as MultiOutput$1, TokenCondition as TokenCondition$1, TokenInput as TokenInput$5 } from "./protocols/governance/claim-stake.cjs";
|
|
@@ -269,6 +268,14 @@ declare const createExecutor: ({
|
|
|
269
268
|
delta: string;
|
|
270
269
|
action: string;
|
|
271
270
|
}>;
|
|
271
|
+
isBridgeV2?: boolean;
|
|
272
|
+
bridge?: _ocap_tx_pipeline0.ResolvedBridge;
|
|
273
|
+
bridgeWithdraw?: {
|
|
274
|
+
amount: string;
|
|
275
|
+
ethRecipient: string;
|
|
276
|
+
};
|
|
277
|
+
reserveAddress?: string;
|
|
278
|
+
reserveState?: any;
|
|
272
279
|
}>;
|
|
273
280
|
createTokenFactory: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCreateTokenFactoryTx> & Partial<_ocap_types0.IWithSender> & Partial<_ocap_types0.IWithDelegator> & Partial<_ocap_types0.IWithDelegation> & Partial<_ocap_types0.IWithStake> & Partial<_ocap_types0.IWithToken> & Partial<_ocap_types0.IWithTokenFactory> & {
|
|
274
281
|
stakeAddress?: string;
|
|
@@ -303,7 +310,6 @@ declare const createExecutor: ({
|
|
|
303
310
|
delta: string;
|
|
304
311
|
}[];
|
|
305
312
|
}>;
|
|
306
|
-
releaseBridgeToken: _ocap_tx_pipeline0.Runner<Context>;
|
|
307
313
|
stake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TStakeTx> & Partial<_ocap_types0.IWithSender> & Partial<_ocap_types0.IWithSigners> & Partial<_ocap_types0.IWithReceiver> & Partial<_ocap_types0.IWithStake> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & {
|
|
308
314
|
inputs?: MultiInput$4[];
|
|
309
315
|
senders?: string[];
|
|
@@ -661,6 +667,14 @@ declare const defaultExecutor: {
|
|
|
661
667
|
delta: string;
|
|
662
668
|
action: string;
|
|
663
669
|
}>;
|
|
670
|
+
isBridgeV2?: boolean;
|
|
671
|
+
bridge?: _ocap_tx_pipeline0.ResolvedBridge;
|
|
672
|
+
bridgeWithdraw?: {
|
|
673
|
+
amount: string;
|
|
674
|
+
ethRecipient: string;
|
|
675
|
+
};
|
|
676
|
+
reserveAddress?: string;
|
|
677
|
+
reserveState?: any;
|
|
664
678
|
}>;
|
|
665
679
|
createTokenFactory: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCreateTokenFactoryTx> & Partial<_ocap_types0.IWithSender> & Partial<_ocap_types0.IWithDelegator> & Partial<_ocap_types0.IWithDelegation> & Partial<_ocap_types0.IWithStake> & Partial<_ocap_types0.IWithToken> & Partial<_ocap_types0.IWithTokenFactory> & {
|
|
666
680
|
stakeAddress?: string;
|
|
@@ -695,7 +709,6 @@ declare const defaultExecutor: {
|
|
|
695
709
|
delta: string;
|
|
696
710
|
}[];
|
|
697
711
|
}>;
|
|
698
|
-
releaseBridgeToken: _ocap_tx_pipeline0.Runner<Context>;
|
|
699
712
|
stake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TStakeTx> & Partial<_ocap_types0.IWithSender> & Partial<_ocap_types0.IWithSigners> & Partial<_ocap_types0.IWithReceiver> & Partial<_ocap_types0.IWithStake> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & {
|
|
700
713
|
inputs?: MultiInput$4[];
|
|
701
714
|
senders?: string[];
|
|
@@ -93,6 +93,7 @@ function isMatchingAccountPublicKey(onChainPk, headerPk) {
|
|
|
93
93
|
const selfStakeInfo = isThirdPartyGasPass ? await resolveSignerSelfGasStake() : null;
|
|
94
94
|
const selfStakeEligible = Boolean(selfStakeInfo?.valid) && require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
95
95
|
txType,
|
|
96
|
+
itx: context.itx,
|
|
96
97
|
txSize,
|
|
97
98
|
gasEstimate,
|
|
98
99
|
isFailedTxGasCharge: isFailedTxGasCharge && canChargeSenderDirectly,
|
|
@@ -197,6 +198,7 @@ function isMatchingAccountPublicKey(onChainPk, headerPk) {
|
|
|
197
198
|
const selfStakeInfo = await resolveSignerSelfGasStake();
|
|
198
199
|
const selfStakeEligible = Boolean(selfStakeInfo.valid) && require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
199
200
|
txType,
|
|
201
|
+
itx: context.itx,
|
|
200
202
|
txSize,
|
|
201
203
|
gasEstimate,
|
|
202
204
|
isFailedTxGasCharge: isFailedTxGasCharge && canChargeSenderDirectly,
|
|
@@ -230,6 +232,7 @@ function isMatchingAccountPublicKey(onChainPk, headerPk) {
|
|
|
230
232
|
if (!gasStake.state && gasStake.stakeId) gasStake.state = await statedb.stake.get(gasStake.stakeId, context);
|
|
231
233
|
const eligibility = require_gas_security_guard.evaluateStakeForGasEligibility({
|
|
232
234
|
txType,
|
|
235
|
+
itx: context.itx,
|
|
233
236
|
txSize,
|
|
234
237
|
gasEstimate,
|
|
235
238
|
isFailedTxGasCharge: isFailedTxGasCharge && canChargeSenderDirectly,
|
|
@@ -5,7 +5,8 @@ import { PipeFunction } from "@ocap/tx-pipeline";
|
|
|
5
5
|
interface IGasEstimate {
|
|
6
6
|
create: number;
|
|
7
7
|
update: number;
|
|
8
|
-
payment
|
|
8
|
+
/** sender payment in the gas token on top of the tx cost (a decimal string for base-unit amounts) */
|
|
9
|
+
payment?: number | string;
|
|
9
10
|
}
|
|
10
11
|
/** Gas estimator function type - uses any for flexible context access */
|
|
11
12
|
type GasEstimatorFn = (context: any) => IGasEstimate;
|
|
@@ -3,6 +3,7 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
|
3
3
|
let debug = require("debug");
|
|
4
4
|
debug = require_rolldown_runtime.__toESM(debug);
|
|
5
5
|
let _ocap_message = require("@ocap/message");
|
|
6
|
+
let _ocap_util_lib_deposit_v2_bridge_fields = require("@ocap/util/lib/deposit-v2-bridge-fields");
|
|
6
7
|
|
|
7
8
|
//#region src/pipes/write-ledger.ts
|
|
8
9
|
/**
|
|
@@ -69,7 +70,7 @@ const WriteLedger = async (context, next) => {
|
|
|
69
70
|
if (extra.txExtra) txExtra.txExtra = extra.txExtra;
|
|
70
71
|
if (extra.gasStakeHeaders) txExtra.gasStakeHeaders = extra.gasStakeHeaders;
|
|
71
72
|
}
|
|
72
|
-
const formattedTx = (0, _ocap_message.formatMessage)("Transaction", tx);
|
|
73
|
+
const formattedTx = (0, _ocap_util_lib_deposit_v2_bridge_fields.stripDefaultDepositV2BridgeFieldsInTx)((0, _ocap_message.formatMessage)("Transaction", tx));
|
|
73
74
|
const txInput = {
|
|
74
75
|
txRaw: txBase64,
|
|
75
76
|
tx: formattedTx,
|