File tree 3 files changed +63
-0
lines changed
packages/apps/tools/src/pact/faucet
3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { createAdmin } from './deploy/createAdmin';
4
4
import { deployFaucet } from './deploy/deployFaucet' ;
5
5
import { fundAdmin } from './deploy/fundAdmin' ;
6
6
import { fundFaucet } from './deploy/fundFaucet' ;
7
+ import { fundGasStation } from './deploy/fundGasStation' ;
7
8
import { rotateKeyset } from './deploy/rotate-keyset' ;
8
9
9
10
const deployInOrder = ( ) => {
@@ -22,6 +23,9 @@ const deployInOrder = () => {
22
23
// console.log('fundFaucet', chain, upgrade);
23
24
// await fundFaucet({ chainId: chain, upgrade });
24
25
26
+ // console.log('fundGasStation', chain, upgrade);
27
+ // await fundGasStation({ chainId: chain, upgrade });
28
+
25
29
// console.log('rotateKeyset', chain, upgrade);
26
30
// await rotateKeyset('faucet-operation', chain);
27
31
} ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ export const DOMAIN:
29
29
30
30
export const COIN_ACCOUNT : string = 'contract-admins' ;
31
31
32
+ export const GAS_STATION = 'c:clGP4RWyk9pvJHO6-f1DOMEknZGtqHtjkKn4NT2hMf0' ;
33
+
32
34
export const GAS_PROVIDER : {
33
35
publicKey : string ;
34
36
privateKey : string ;
Original file line number Diff line number Diff line change
1
+ import type { ChainwebChainId } from '@kadena/chainweb-node-client' ;
2
+ import { createSignWithKeypair } from '@kadena/client' ;
3
+ import { transfer } from '@kadena/client-utils/coin' ;
4
+ import {
5
+ COIN_ACCOUNT ,
6
+ DOMAIN ,
7
+ GAS_PROVIDER ,
8
+ GAS_STATION ,
9
+ NETWORK_ID ,
10
+ } from './constants' ;
11
+
12
+ export const fundGasStation = async ( {
13
+ chainId,
14
+ upgrade,
15
+ } : {
16
+ chainId : ChainwebChainId ;
17
+ upgrade : boolean ;
18
+ } ) => {
19
+ if ( upgrade ) {
20
+ return 'The step "fundGasStation" is skipped for upgrades' ;
21
+ }
22
+
23
+ const result = await transfer (
24
+ {
25
+ sender : {
26
+ account : COIN_ACCOUNT ,
27
+ publicKeys : [ GAS_PROVIDER . publicKey ] ,
28
+ } ,
29
+ receiver : GAS_STATION ,
30
+ amount : '1' ,
31
+ gasPayer : {
32
+ account : GAS_PROVIDER . accountName ,
33
+ publicKeys : [ GAS_PROVIDER . publicKey ] ,
34
+ } ,
35
+ chainId,
36
+ } ,
37
+ {
38
+ host : ( { networkId, chainId } ) =>
39
+ `${ DOMAIN } /chainweb/0.0/${ networkId } /chain/${ chainId } /pact` ,
40
+ defaults : { networkId : NETWORK_ID } ,
41
+ sign : createSignWithKeypair ( [
42
+ {
43
+ publicKey : GAS_PROVIDER . publicKey ,
44
+ secretKey : GAS_PROVIDER . privateKey ,
45
+ } ,
46
+ ] ) ,
47
+ } ,
48
+ )
49
+ . on ( 'sign' , ( data ) => console . log ( data ) )
50
+ . on ( 'preflight' , ( data ) => console . log ( data ) )
51
+ . on ( 'submit' , ( data ) => console . log ( data ) )
52
+ . on ( 'listen' , ( data ) => console . log ( data ) )
53
+ . execute ( ) ;
54
+
55
+ console . log ( result ) ;
56
+ return ;
57
+ } ;
You can’t perform that action at this time.
0 commit comments