@@ -5,6 +5,8 @@ import fs from 'fs';
5
5
import path from 'path' ;
6
6
import { LoggerFactory } from '../src/logging/LoggerFactory' ;
7
7
import { defaultCacheOptions , WarpFactory } from '../src/core/WarpFactory' ;
8
+ import { DeployPlugin } from 'warp-contracts-plugin-deploy' ;
9
+ import { ArweaveSigner } from 'warp-arbundles' ;
8
10
9
11
class FetchOptionsPlugin implements WarpPlugin < FetchRequest , RequestInit > {
10
12
process ( request : FetchRequest ) : Partial < RequestInit > {
@@ -18,6 +20,17 @@ class FetchOptionsPlugin implements WarpPlugin<FetchRequest, RequestInit> {
18
20
} ;
19
21
}
20
22
23
+ if (
24
+ url ==
25
+ 'https://gw.warp.cc/gateway/v3/interactions-sort-key?contractId=nf5TUVkzyZBGtl0NmVXZvheC3EN5d4XA-5ewpGgaYRo&fromSdk=true&confirmationStatus=not_corrupted'
26
+ ) {
27
+ fetchOptions = {
28
+ headers : {
29
+ 'x-api-key' : 'test'
30
+ }
31
+ } ;
32
+ }
33
+
21
34
return fetchOptions ;
22
35
}
23
36
@@ -32,18 +45,20 @@ async function main() {
32
45
const logger = LoggerFactory . INST . create ( 'FetchOptionsPlugin' ) ;
33
46
34
47
try {
35
- const warp = WarpFactory . forMainnet ( { ...defaultCacheOptions , inMemory : true } ) . use ( new FetchOptionsPlugin ( ) ) ;
48
+ const warp = WarpFactory . forMainnet ( { ...defaultCacheOptions , inMemory : true } )
49
+ . use ( new DeployPlugin ( ) )
50
+ . use ( new FetchOptionsPlugin ( ) ) ;
36
51
37
52
const jsContractSrc = fs . readFileSync ( path . join ( __dirname , 'data/js/token-pst.js' ) , 'utf8' ) ;
38
53
const initialState = fs . readFileSync ( path . join ( __dirname , 'data/js/token-pst.json' ) , 'utf8' ) ;
39
54
40
- const { contractTxId } = await warp . createContract . deploy ( {
41
- wallet,
55
+ const { contractTxId } = await warp . deploy ( {
56
+ wallet : new ArweaveSigner ( wallet ) ,
42
57
initState : initialState ,
43
58
src : jsContractSrc
44
59
} ) ;
45
60
46
- const contract = warp . contract ( contractTxId ) . connect ( wallet ) ;
61
+ const contract = warp . contract ( contractTxId ) . connect ( new ArweaveSigner ( wallet ) ) ;
47
62
48
63
await contract . writeInteraction ( {
49
64
function : 'transfer' ,
0 commit comments