1
1
import { M } from '@endo/patterns' ;
2
+ import { BrandShape , RatioShape } from '@agoric/ertp' ;
3
+ import { PendingTxStatus } from './constants.js' ;
2
4
3
5
/**
4
- * @import {TypedPattern} from '@agoric/internal'
5
- * @import {USDCProposalShapes} from './pool-share-math'
6
+ * @import {TypedPattern} from '@agoric/internal';
7
+ * @import {USDCProposalShapes} from './pool-share-math';
8
+ * @import {CctpTxEvidence, FeeConfig, PendingTx} from './types.js';
6
9
*/
7
10
8
11
/**
@@ -26,3 +29,50 @@ export const makeProposalShapes = ({ PoolShares, USDC }) => {
26
29
} ) ;
27
30
return harden ( { deposit, withdraw } ) ;
28
31
} ;
32
+
33
+ /** @type {TypedPattern<string> } */
34
+ export const EvmHashShape = M . string ( {
35
+ stringLengthLimit : 66 ,
36
+ } ) ;
37
+ harden ( EvmHashShape ) ;
38
+
39
+ /** @type {TypedPattern<CctpTxEvidence> } */
40
+ export const CctpTxEvidenceShape = {
41
+ aux : {
42
+ forwardingChannel : M . string ( ) ,
43
+ recipientAddress : M . string ( ) ,
44
+ } ,
45
+ blockHash : EvmHashShape ,
46
+ blockNumber : M . bigint ( ) ,
47
+ blockTimestamp : M . bigint ( ) ,
48
+ chainId : M . number ( ) ,
49
+ tx : {
50
+ amount : M . bigint ( ) ,
51
+ forwardingAddress : M . string ( ) ,
52
+ } ,
53
+ txHash : EvmHashShape ,
54
+ } ;
55
+ harden ( CctpTxEvidenceShape ) ;
56
+
57
+ /** @type {TypedPattern<PendingTx> } */
58
+ // @ts -expect-error TypedPattern can't handle spreading?
59
+ export const PendingTxShape = {
60
+ ...CctpTxEvidenceShape ,
61
+ status : M . or ( ...Object . values ( PendingTxStatus ) ) ,
62
+ } ;
63
+ harden ( PendingTxShape ) ;
64
+
65
+ export const EudParamShape = {
66
+ EUD : M . string ( ) ,
67
+ } ;
68
+ harden ( EudParamShape ) ;
69
+
70
+ const NatAmountShape = { brand : BrandShape , value : M . nat ( ) } ;
71
+ /** @type {TypedPattern<FeeConfig> } */
72
+ export const FeeConfigShape = {
73
+ flat : NatAmountShape ,
74
+ variableRate : RatioShape ,
75
+ maxVariable : NatAmountShape ,
76
+ contractRate : RatioShape ,
77
+ } ;
78
+ harden ( FeeConfigShape ) ;
0 commit comments