File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ import { placeholder } from '@cashscript/utils';
3
3
import {
4
4
Contract ,
5
5
ElectrumNetworkProvider ,
6
+ MockNetworkProvider ,
6
7
Network ,
8
+ randomUtxo ,
7
9
SignatureTemplate ,
8
10
} from '../src/index.js' ;
9
11
import {
@@ -110,6 +112,21 @@ describe('Contract', () => {
110
112
} ) ;
111
113
} ) ;
112
114
115
+ describe ( 'getUtxos' , ( ) => {
116
+ it ( 'should return utxos for existing contract on mocknet' , async ( ) => {
117
+ const provider = new MockNetworkProvider ( ) ;
118
+ const instance = new Contract ( p2pkhArtifact , [ alicePkh ] , { provider } ) ;
119
+
120
+ provider . addUtxo ( instance . address , randomUtxo ( ) ) ;
121
+
122
+ const utxos = await instance . getUtxos ( ) ;
123
+ const utxosFromProvider = await provider . getUtxos ( instance . address ) ;
124
+
125
+ expect ( utxos ) . toHaveLength ( 1 ) ;
126
+ expect ( utxos ) . toEqual ( utxosFromProvider ) ;
127
+ } ) ;
128
+ } ) ;
129
+
113
130
describe ( 'Contract functions' , ( ) => {
114
131
let instance : Contract ;
115
132
let bbInstance : Contract ;
You can’t perform that action at this time.
0 commit comments