1
1
import { Connection , PublicKey } from "@solana/web3.js" ;
2
- import { ChainId , toChainId , isChainId } from "@wormhole-foundation/sdk-base" ;
2
+ import { ChainId , isChainId , toChainId } from "@wormhole-foundation/sdk-base" ;
3
3
import { deserialize , keccak256 } from "@wormhole-foundation/sdk-definitions" ;
4
4
import { ethers } from "ethers" ;
5
5
export * from "./spy" ;
@@ -133,9 +133,9 @@ export class VaaAccount {
133
133
}
134
134
}
135
135
136
- digest ( ) : Uint8Array {
136
+ hash ( ) : Uint8Array {
137
137
if ( this . _encodedVaa !== undefined ) {
138
- return keccak256 ( deserialize ( "Uint8Array" , this . _encodedVaa . buf ) . hash ) ;
138
+ return deserialize ( "Uint8Array" , this . _encodedVaa . buf ) . hash ;
139
139
} else if ( this . _postedVaaV1 !== undefined ) {
140
140
const {
141
141
consistencyLevel,
@@ -158,12 +158,16 @@ export class VaaAccount {
158
158
offset = buf . writeUInt8 ( consistencyLevel , offset ) ;
159
159
buf . set ( payload , offset ) ;
160
160
161
- return ethers . utils . arrayify ( ethers . utils . keccak256 ( ethers . utils . keccak256 ( buf ) ) ) ;
161
+ return ethers . utils . arrayify ( ethers . utils . keccak256 ( buf ) ) ;
162
162
} else {
163
- throw new Error ( "impossible: digest () failed" ) ;
163
+ throw new Error ( "impossible: hash () failed" ) ;
164
164
}
165
165
}
166
166
167
+ digest ( ) : Uint8Array {
168
+ return keccak256 ( this . hash ( ) ) ;
169
+ }
170
+
167
171
get encodedVaa ( ) : EncodedVaa {
168
172
if ( this . _encodedVaa === undefined ) {
169
173
throw new Error ( "VaaAccount does not have encodedVaa" ) ;
0 commit comments