|
| 1 | +import { Kiln } from "../src/kiln"; |
| 2 | + |
| 3 | +const fs = require('fs'); |
| 4 | + |
| 5 | +const apiSecret = fs.readFileSync(__dirname + '/fireblocks_secret.key', 'utf8'); |
| 6 | + |
| 7 | +const f = async () => { |
| 8 | + const k = new Kiln({ |
| 9 | + testnet: true, |
| 10 | + apiToken: 'kiln_Q3VFTHU0WW85Q2Z1dXJqMUFYSmtFYnFIZElpM3dwbFE6WWhxNGlobEJEbzktMm1zUm4tdUJhUDdPZml0NTdxdTIxVEVYczZlaDVQVTlEVk9TM1B5N0J6UV9xSFJVRzJKTg', |
| 11 | + integrations: [ |
| 12 | + { |
| 13 | + name: 'vault1', |
| 14 | + provider: 'fireblocks', |
| 15 | + fireblocksApiKey: '53aee35e-04b7-9314-8f28-135a66c8af2c', |
| 16 | + fireblocksSecretKey: apiSecret, |
| 17 | + vaultAccountId: '7' |
| 18 | + } |
| 19 | + ], |
| 20 | + }); |
| 21 | + |
| 22 | + try { |
| 23 | + const amountWei = k.matic.maticToWei('0.4'); |
| 24 | + console.log('crafting...'); |
| 25 | + // const txApprove = await k.matic.craftApproveTx( |
| 26 | + // '0x296a8F811Af114f43db2Bdb2cFB595Cc1Dc4176D', |
| 27 | + // '0x00200eA4Ee292E253E6Ca07dBA5EdC07c8Aa37A3', |
| 28 | + // amountWei, |
| 29 | + // ); |
| 30 | + // const txStake = await k.matic.craftBuyVoucherTx( |
| 31 | + // 'd3f1b917-72b1-4982-a4dd-93fce579a708', |
| 32 | + // '0x296a8F811Af114f43db2Bdb2cFB595Cc1Dc4176D', |
| 33 | + // amountWei, |
| 34 | + // ); |
| 35 | + // const txStake = await k.matic.craftSellVoucherTx( |
| 36 | + // '0x9ce658155a6f05fe4aef83b7fa8f431d5e8ccb55', |
| 37 | + // amountWei, |
| 38 | + // ); |
| 39 | + // const txStake = await k.matic.craftUnstakeClaimTokensTx( |
| 40 | + // '0x9ce658155a6f05fe4aef83b7fa8f431d5e8ccb55', |
| 41 | + // ); |
| 42 | + // const txStake = await k.matic.craftWithdrawRewardsTx( |
| 43 | + // '0x9ce658155a6f05fe4aef83b7fa8f431d5e8ccb55', |
| 44 | + // ); |
| 45 | + const txStake = await k.matic.craftRestakeRewardsTx( |
| 46 | + '0x9ce658155a6f05fe4aef83b7fa8f431d5e8ccb55', |
| 47 | + ); |
| 48 | + console.log('signing...'); |
| 49 | + const txSigned2 = await k.matic.sign('vault1', txStake); |
| 50 | + console.log('broadcasting...'); |
| 51 | + const hash2 = await k.matic.broadcast(txSigned2); |
| 52 | + console.log(hash2); |
| 53 | + } catch (err) { |
| 54 | + console.log(err); |
| 55 | + } |
| 56 | +}; |
| 57 | + |
| 58 | +f(); |
0 commit comments