Skip to content

Commit 829361d

Browse files
author
Sander Looijenga
committed
New fundGasStation step of deploy script
1 parent 6510dfd commit 829361d

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

packages/apps/tools/src/pact/faucet/deploy.ts

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { createAdmin } from './deploy/createAdmin';
44
import { deployFaucet } from './deploy/deployFaucet';
55
import { fundAdmin } from './deploy/fundAdmin';
66
import { fundFaucet } from './deploy/fundFaucet';
7+
import { fundGasStation } from './deploy/fundGasStation';
78
import { rotateKeyset } from './deploy/rotate-keyset';
89

910
const deployInOrder = () => {
@@ -22,6 +23,9 @@ const deployInOrder = () => {
2223
// console.log('fundFaucet', chain, upgrade);
2324
// await fundFaucet({ chainId: chain, upgrade });
2425

26+
// console.log('fundGasStation', chain, upgrade);
27+
// await fundGasStation({ chainId: chain, upgrade });
28+
2529
// console.log('rotateKeyset', chain, upgrade);
2630
// await rotateKeyset('faucet-operation', chain);
2731
});

packages/apps/tools/src/pact/faucet/deploy/constants.ts

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export const DOMAIN:
2929

3030
export const COIN_ACCOUNT: string = 'contract-admins';
3131

32+
export const GAS_STATION = 'c:clGP4RWyk9pvJHO6-f1DOMEknZGtqHtjkKn4NT2hMf0';
33+
3234
export const GAS_PROVIDER: {
3335
publicKey: string;
3436
privateKey: string;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
};

0 commit comments

Comments
 (0)