11import fs from 'fs' ;
2- import { compressProgram , randomAddress , makeAddress , JsonParser } from '../src/utils' ;
3- import { CompiledContract } from '../src/types' ;
4- import * as starknet from '../src/index' ;
2+ import {
3+ CompiledContract ,
4+ compressProgram ,
5+ randomAddress ,
6+ JsonParser ,
7+ getContractAddresses ,
8+ getBlock ,
9+ getCode ,
10+ getStorageAt ,
11+ getTransactionStatus ,
12+ getTransaction ,
13+ addTransaction ,
14+ deployContract ,
15+ } from '../src' ;
516
617const compiledArgentAccount = JsonParser . parse (
718 fs . readFileSync ( './__mocks__/ArgentAccount.json' ) . toString ( 'ascii' )
@@ -10,31 +21,27 @@ const compiledArgentAccount = JsonParser.parse(
1021describe ( 'starknet endpoints' , ( ) => {
1122 describe ( 'feeder gateway endpoints' , ( ) => {
1223 test ( 'getContractAddresses()' , ( ) => {
13- return expect ( starknet . getContractAddresses ( ) ) . resolves . not . toThrow ( ) ;
24+ return expect ( getContractAddresses ( ) ) . resolves . not . toThrow ( ) ;
1425 } ) ;
1526 xtest ( 'callContract()' , ( ) => { } ) ;
1627 test ( 'getBlock()' , ( ) => {
17- return expect ( starknet . getBlock ( 46500 ) ) . resolves . not . toThrow ( ) ;
28+ return expect ( getBlock ( 46500 ) ) . resolves . not . toThrow ( ) ;
1829 } ) ;
1930 test ( 'getCode()' , ( ) => {
2031 return expect (
21- starknet . getCode ( '0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d' , 46500 )
32+ getCode ( '0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d' , 46500 )
2233 ) . resolves . not . toThrow ( ) ;
2334 } ) ;
2435 test ( 'getStorageAt()' , ( ) => {
2536 return expect (
26- starknet . getStorageAt (
27- '0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d' ,
28- 0 ,
29- 46500
30- )
37+ getStorageAt ( '0x5f778a983bf8760ad37868f4c869d70247c5546044a7f0386df96d8043d4e9d' , 0 , 46500 )
3138 ) . resolves . not . toThrow ( ) ;
3239 } ) ;
3340 test ( 'getTransactionStatus()' , ( ) => {
34- return expect ( starknet . getTransactionStatus ( 286136 ) ) . resolves . not . toThrow ( ) ;
41+ return expect ( getTransactionStatus ( 286136 ) ) . resolves . not . toThrow ( ) ;
3542 } ) ;
3643 test ( 'getTransaction()' , ( ) => {
37- return expect ( starknet . getTransaction ( 286136 ) ) . resolves . not . toThrow ( ) ;
44+ return expect ( getTransaction ( 286136 ) ) . resolves . not . toThrow ( ) ;
3845 } ) ;
3946 } ) ;
4047
@@ -47,7 +54,7 @@ describe('starknet endpoints', () => {
4754 program : compressProgram ( inputContract . program ) ,
4855 } ;
4956
50- const response = await starknet . addTransaction ( {
57+ const response = await addTransaction ( {
5158 type : 'DEPLOY' ,
5259 contract_address : randomAddress ( ) ,
5360 contract_definition : contractDefinition ,
@@ -59,15 +66,11 @@ describe('starknet endpoints', () => {
5966 // eslint-disable-next-line no-console
6067 console . log ( 'txId:' , response . tx_id ) ;
6168 } ) ;
62- xtest ( 'type: "INVOKE_FUNCTION"' , ( ) => { } ) ;
6369
6470 test ( 'deployContract()' , async ( ) => {
6571 const inputContract = compiledArgentAccount as unknown as CompiledContract ;
6672
67- const response = await starknet . deployContract (
68- inputContract ,
69- makeAddress ( '0x20b5B1b8aFd65F1FCB755a449000cFC4aBCA0D40' )
70- ) ;
73+ const response = await deployContract ( inputContract ) ;
7174 expect ( response . code ) . toBe ( 'TRANSACTION_RECEIVED' ) ;
7275 expect ( response . tx_id ) . toBeGreaterThan ( 0 ) ;
7376
0 commit comments