/
contract-origination.ts
52 lines (47 loc) · 1.45 KB
/
contract-origination.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { Tezos } from '@taquito/taquito';
const provider = 'https://alphanet-node.tzscan.io';
async function example() {
Tezos.setProvider({ rpc: provider } as any)
await Tezos.importKey("peqjckge.qkrrajzs@tezos.example.org", "y4BX7qS1UE", [
"skate",
"damp",
"faculty",
"morning",
"bring",
"ridge",
"traffic",
"initial",
"piece",
"annual",
"give",
"say",
"wrestle",
"rare",
"ability"
].join(" "), "7d4c8c3796fdbf4869edb5703758f0e5831f5081")
try {
console.log('Deploying Hello world contract...')
const op = await Tezos.contract.originate({
balance: "0",
code: `parameter string;
storage string;
code {CAR;
PUSH string "Hello ";
CONCAT;
NIL operation; PAIR};
`,
init: `"test1234"`
})
console.log('Awaiting confirmation...')
const contract = await op.contract()
console.log('Gas Used', op.consumedGas)
console.log('Storage Paid', op.storageDiff)
console.log('Storage Size', op.storageSize)
console.log('Storage', await contract.storage())
console.log("Operation hash:", op.hash, "Included in block level:", op.includedInBlock)
} catch (ex) {
console.error(ex)
}
}
// tslint:disable-next-line: no-floating-promises
example();