|
| 1 | +import { Types } from '../../../bindings/mina-transaction/v1/types.js'; |
| 2 | +import { Proof } from '../../proof-system/proof.js'; |
| 3 | +import { Empty } from '../../proof-system/zkprogram.js'; |
| 4 | +import { PrivateKey, PublicKey } from '../../provable/crypto/signature.js'; |
| 5 | +import { UInt32, UInt64 } from '../../provable/int.js'; |
| 6 | +import { Provable } from '../../provable/provable.js'; |
| 7 | +import { Field } from '../../provable/wrapped.js'; |
| 8 | +import { assertPromise } from '../../util/assert.js'; |
1 | 9 | import { |
2 | | - ZkappCommand, |
3 | 10 | AccountUpdate, |
4 | | - ZkappPublicInput, |
5 | 11 | AccountUpdateLayout, |
6 | 12 | FeePayerUnsigned, |
7 | | - addMissingSignatures, |
8 | 13 | TokenId, |
| 14 | + ZkappCommand, |
| 15 | + ZkappPublicInput, |
9 | 16 | addMissingProofs, |
| 17 | + addMissingSignatures, |
10 | 18 | } from './account-update.js'; |
11 | | -import { Field } from '../../provable/wrapped.js'; |
12 | | -import { PrivateKey, PublicKey } from '../../provable/crypto/signature.js'; |
13 | | -import { UInt32, UInt64 } from '../../provable/int.js'; |
14 | | -import { Empty } from '../../proof-system/zkprogram.js'; |
15 | | -import { Proof } from '../../proof-system/proof.js'; |
16 | | -import { currentTransaction } from './transaction-context.js'; |
17 | | -import { Provable } from '../../provable/provable.js'; |
18 | | -import { assertPreconditionInvariants } from './precondition.js'; |
19 | 19 | import { Account } from './account.js'; |
20 | | -import { type FeePayerSpec, activeInstance } from './mina-instance.js'; |
21 | 20 | import * as Fetch from './fetch.js'; |
22 | | -import { type SendZkAppResponse, sendZkappQuery } from './graphql.js'; |
23 | | -import { type FetchMode } from './transaction-context.js'; |
24 | | -import { assertPromise } from '../../util/assert.js'; |
25 | | -import { Types } from '../../../bindings/mina-transaction/v1/types.js'; |
| 21 | +import { sendZkappQuery, type SendZkAppResponse } from './graphql.js'; |
| 22 | +import { activeInstance, type FeePayerSpec } from './mina-instance.js'; |
| 23 | +import { assertPreconditionInvariants } from './precondition.js'; |
| 24 | +import { currentTransaction, type FetchMode } from './transaction-context.js'; |
26 | 25 | import { getTotalTimeRequired } from './transaction-validation.js'; |
27 | 26 |
|
28 | 27 | export { |
29 | 28 | Transaction, |
30 | | - type TransactionPromise, |
31 | | - type PendingTransaction, |
32 | | - type IncludedTransaction, |
33 | | - type RejectedTransaction, |
34 | | - type PendingTransactionPromise, |
35 | | - type PendingTransactionStatus, |
| 29 | + createIncludedTransaction, |
| 30 | + createRejectedTransaction, |
36 | 31 | createTransaction, |
37 | | - toTransactionPromise, |
38 | | - toPendingTransactionPromise, |
39 | | - sendTransaction, |
40 | | - newTransaction, |
41 | 32 | getAccount, |
| 33 | + newTransaction, |
| 34 | + sendTransaction, |
| 35 | + toPendingTransactionPromise, |
| 36 | + toTransactionPromise, |
42 | 37 | transaction, |
43 | | - createRejectedTransaction, |
44 | | - createIncludedTransaction, |
| 38 | + type IncludedTransaction, |
| 39 | + type PendingTransaction, |
| 40 | + type PendingTransactionPromise, |
| 41 | + type PendingTransactionStatus, |
| 42 | + type RejectedTransaction, |
| 43 | + type TransactionPromise |
45 | 44 | }; |
46 | 45 |
|
47 | 46 | type TransactionCommon = { |
@@ -141,10 +140,6 @@ type Transaction<Proven extends boolean, Signed extends boolean> = TransactionCo |
141 | 140 | * ``` |
142 | 141 | */ |
143 | 142 | setFee(newFee: UInt64): TransactionPromise<Proven, false>; |
144 | | - /** |
145 | | - * setFeePerSnarkCost behaves identically to {@link Transaction.setFee} but the fee is given per estimated cost of snarking the transition as given by {@link getTotalTimeRequired}. This is useful because it should reflect what snark workers would charge in times of network contention. |
146 | | - */ |
147 | | - setFeePerSnarkCost(newFeePerSnarkCost: number): TransactionPromise<Proven, false>; |
148 | 143 | } & (Proven extends false |
149 | 144 | ? { |
150 | 145 | /** |
@@ -280,10 +275,6 @@ type PendingTransaction = Pick<TransactionCommon, 'transaction' | 'toJSON' | 'to |
280 | 275 | * setFee is the same as {@link Transaction.setFee(newFee)} but for a {@link PendingTransaction}. |
281 | 276 | */ |
282 | 277 | setFee(newFee: UInt64): TransactionPromise<boolean, false>; |
283 | | - /** |
284 | | - * setFeePerSnarkCost is the same as {@link Transaction.setFeePerSnarkCost(newFeePerSnarkCost)} but for a {@link PendingTransaction}. |
285 | | - */ |
286 | | - setFeePerSnarkCost(newFeePerSnarkCost: number): TransactionPromise<boolean, false>; |
287 | 278 | }; |
288 | 279 |
|
289 | 280 | /** |
@@ -560,10 +551,6 @@ function newTransaction(transaction: ZkappCommand, proofsEnabled?: boolean) { |
560 | 551 | } |
561 | 552 | return pendingTransaction; |
562 | 553 | }, |
563 | | - setFeePerSnarkCost(newFeePerSnarkCost: number) { |
564 | | - let { totalTimeRequired } = getTotalTimeRequired(transaction.accountUpdates); |
565 | | - return this.setFee(new UInt64(Math.round(totalTimeRequired * newFeePerSnarkCost))); |
566 | | - }, |
567 | 554 | setFee(newFee: UInt64) { |
568 | 555 | return toTransactionPromise(async () => { |
569 | 556 | self = self as Transaction<false, false>; |
|
0 commit comments