Skip to content

Commit

Permalink
Merge pull request #612 from ecadlabs/parser-provider-test
Browse files Browse the repository at this point in the history
Replace edo version
  • Loading branch information
jevonearth authored Feb 12, 2021
2 parents f81c3df + 63daf49 commit df652b3
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 82 deletions.
16 changes: 8 additions & 8 deletions integration-tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ interface FaucetConfig {

const edonetEphemeral = {
rpc: process.env['TEZOS_RPC_EDONET'] || 'https://api.tez.ie/rpc/edonet',
knownBaker: 'tz1ScKYRsTP7rkPsU8VRNKFYyCoCBPX4WADJ',
knownContract: 'KT1ETP77nkHvrkVzfV3AydrHMpbER4Et7s3y',
knownBigMapContract: 'KT1P4eFWszS7Y9qom4SjnM15GJcYzsnVH4ER',
protocol: Protocols.PtEdoTez,
knownBaker: 'tz1R55a2HQbXUAzWKJYE5bJp3UvvawwCm9Pr',
knownContract: 'KT1MTFjUeqBeZoFeW1NLSrzJdcS5apFiUXoB',
knownBigMapContract: 'KT1Aqk5xE36Kx7JUUV8VMx4t9jLgQn4MBWQk',
protocol: Protocols.PtEdo27k,
signerConfig: {
type: SignerType.EPHEMERAL_KEY as SignerType.EPHEMERAL_KEY,
keyUrl: 'https://api.tez.ie/keys/edonet',
Expand Down Expand Up @@ -131,10 +131,10 @@ const key = {

const edonetFaucet = {
rpc: 'https://api.tez.ie/rpc/edonet',
knownBaker: 'tz1ScKYRsTP7rkPsU8VRNKFYyCoCBPX4WADJ',
knownContract: 'KT1ETP77nkHvrkVzfV3AydrHMpbER4Et7s3y',
knownBigMapContract: 'KT1P4eFWszS7Y9qom4SjnM15GJcYzsnVH4ER',
protocol: Protocols.PtEdoTez,
knownBaker: 'tz1R55a2HQbXUAzWKJYE5bJp3UvvawwCm9Pr',
knownContract: 'KT1MTFjUeqBeZoFeW1NLSrzJdcS5apFiUXoB',
knownBigMapContract: 'KT1Aqk5xE36Kx7JUUV8VMx4t9jLgQn4MBWQk',
protocol: Protocols.PtEdo27k,
signerConfig: {
type: SignerType.FAUCET as SignerType.FAUCET,
faucetKey: key,
Expand Down
74 changes: 37 additions & 37 deletions integration-tests/contract-estimation-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {

const carthagenet = (protocol === Protocols.PsCARTHA) ? test : test.skip;
const delphinet = (protocol === Protocols.PsDELPH1) ? test : test.skip;
const edonet = (protocol === Protocols.PtEdoTez) ? test : test.skip;
const edonet = (protocol === Protocols.PtEdo27k) ? test : test.skip;

describe('Estimate scenario', () => {
let LowAmountTez: TezosToolkit;
Expand Down Expand Up @@ -70,11 +70,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
const estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), amount: 1.9 });
expect(estimate.gasLimit).toEqual(1527);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(506);
expect(estimate.suggestedFeeMutez).toEqual(504);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(406);
expect(estimate.totalCost).toEqual(406);
expect(estimate.usingBaseFeeMutez).toEqual(406);
expect(estimate.minimalFeeMutez).toEqual(404);
expect(estimate.totalCost).toEqual(404);
expect(estimate.usingBaseFeeMutez).toEqual(404);
expect(estimate.consumedMilligas).toEqual(1427000);
done();
})
Expand Down Expand Up @@ -109,11 +109,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
const estimate = await LowAmountTez.estimate.transfer({ to: await (await createAddress()).signer.publicKeyHash(), amount: 1.7 });
expect(estimate.gasLimit).toEqual(1527);
expect(estimate.storageLimit).toEqual(257);
expect(estimate.suggestedFeeMutez).toEqual(506);
expect(estimate.suggestedFeeMutez).toEqual(504);
expect(estimate.burnFeeMutez).toEqual(64250);
expect(estimate.minimalFeeMutez).toEqual(406);
expect(estimate.totalCost).toEqual(64656);
expect(estimate.usingBaseFeeMutez).toEqual(406);
expect(estimate.minimalFeeMutez).toEqual(404);
expect(estimate.totalCost).toEqual(64654);
expect(estimate.usingBaseFeeMutez).toEqual(404);
expect(estimate.consumedMilligas).toEqual(1427000);
done();
});
Expand Down Expand Up @@ -143,11 +143,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
})
expect(estimate.gasLimit).toEqual(2751);
expect(estimate.storageLimit).toEqual(571);
expect(estimate.suggestedFeeMutez).toEqual(921);
expect(estimate.suggestedFeeMutez).toEqual(919);
expect(estimate.burnFeeMutez).toEqual(142750);
expect(estimate.minimalFeeMutez).toEqual(821);
expect(estimate.totalCost).toEqual(143571);
expect(estimate.usingBaseFeeMutez).toEqual(821);
expect(estimate.minimalFeeMutez).toEqual(819);
expect(estimate.totalCost).toEqual(143569);
expect(estimate.usingBaseFeeMutez).toEqual(819);
expect(estimate.consumedMilligas).toEqual(2650621);
done();
});
Expand Down Expand Up @@ -192,11 +192,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
})
expect(estimate.gasLimit).toEqual(1100);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(459);
expect(estimate.suggestedFeeMutez).toEqual(457);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(359);
expect(estimate.totalCost).toEqual(359);
expect(estimate.usingBaseFeeMutez).toEqual(359);
expect(estimate.minimalFeeMutez).toEqual(357);
expect(estimate.totalCost).toEqual(357);
expect(estimate.usingBaseFeeMutez).toEqual(357);
expect(estimate.consumedMilligas).toEqual(1000000);
done();
})
Expand Down Expand Up @@ -236,11 +236,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
const estimate = await LowAmountTez.estimate.transfer(tx)
expect(estimate.gasLimit).toEqual(4939);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(920);
expect(estimate.suggestedFeeMutez).toEqual(918);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(820);
expect(estimate.totalCost).toEqual(820);
expect(estimate.usingBaseFeeMutez).toEqual(820);
expect(estimate.minimalFeeMutez).toEqual(818);
expect(estimate.totalCost).toEqual(818);
expect(estimate.usingBaseFeeMutez).toEqual(818);
expect(estimate.consumedMilligas).toEqual(4838226);
done();
})
Expand Down Expand Up @@ -286,11 +286,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
const estimate = await LowAmountTez.estimate.transfer(tx)
expect(estimate.gasLimit).toEqual(6525);
expect(estimate.storageLimit).toEqual(514);
expect(estimate.suggestedFeeMutez).toEqual(1138);
expect(estimate.suggestedFeeMutez).toEqual(1136);
expect(estimate.burnFeeMutez).toEqual(128500);
expect(estimate.minimalFeeMutez).toEqual(1038);
expect(estimate.totalCost).toEqual(129538);
expect(estimate.usingBaseFeeMutez).toEqual(1038);
expect(estimate.minimalFeeMutez).toEqual(1036);
expect(estimate.totalCost).toEqual(129536);
expect(estimate.usingBaseFeeMutez).toEqual(1036);
expect(estimate.consumedMilligas).toEqual(6424016);
done();
})
Expand Down Expand Up @@ -332,11 +332,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
const estimate = await LowAmountTez.estimate.transfer(tx)
expect(estimate.gasLimit).toEqual(5491);
expect(estimate.storageLimit).toEqual(317);
expect(estimate.suggestedFeeMutez).toEqual(982);
expect(estimate.suggestedFeeMutez).toEqual(980);
expect(estimate.burnFeeMutez).toEqual(79250);
expect(estimate.minimalFeeMutez).toEqual(882);
expect(estimate.totalCost).toEqual(80132);
expect(estimate.usingBaseFeeMutez).toEqual(882);
expect(estimate.minimalFeeMutez).toEqual(880);
expect(estimate.totalCost).toEqual(80130);
expect(estimate.usingBaseFeeMutez).toEqual(880);
expect(estimate.consumedMilligas).toEqual(5390686);
done();
})
Expand Down Expand Up @@ -377,11 +377,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
const estimate = await LowAmountTez.estimate.transfer(tx)
expect(estimate.gasLimit).toEqual(7629);
expect(estimate.storageLimit).toEqual(634);
expect(estimate.suggestedFeeMutez).toEqual(1260);
expect(estimate.suggestedFeeMutez).toEqual(1258);
expect(estimate.burnFeeMutez).toEqual(158500);
expect(estimate.minimalFeeMutez).toEqual(1160);
expect(estimate.totalCost).toEqual(159660);
expect(estimate.usingBaseFeeMutez).toEqual(1160);
expect(estimate.minimalFeeMutez).toEqual(1158);
expect(estimate.totalCost).toEqual(159658);
expect(estimate.usingBaseFeeMutez).toEqual(1158);
expect(estimate.consumedMilligas).toEqual(7528936);
// Do the actual operation
const op2 = await contract.methods.do(originate2()).send();
Expand Down Expand Up @@ -450,11 +450,11 @@ CONFIGS().forEach(({ lib, setup, knownBaker, createAddress, protocol }) => {
let estimate = await LowAmountTez.estimate.transfer({ to: await Tezos.signer.publicKeyHash(), mutez: true, amount: amt - (1382 + DEFAULT_FEE.REVEAL) });
expect(estimate.gasLimit).toEqual(1527);
expect(estimate.storageLimit).toEqual(0);
expect(estimate.suggestedFeeMutez).toEqual(504);
expect(estimate.suggestedFeeMutez).toEqual(502);
expect(estimate.burnFeeMutez).toEqual(0);
expect(estimate.minimalFeeMutez).toEqual(404);
expect(estimate.totalCost).toEqual(404);
expect(estimate.usingBaseFeeMutez).toEqual(404);
expect(estimate.minimalFeeMutez).toEqual(402);
expect(estimate.totalCost).toEqual(402);
expect(estimate.usingBaseFeeMutez).toEqual(402);
expect(estimate.consumedMilligas).toEqual(1427000);
done();
});
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/contract-originate-contract-unpair.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -50,7 +50,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -77,7 +77,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -101,7 +101,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -125,7 +125,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -152,7 +152,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CONFIGS } from "./config";
import { rpcContractResponse, rpcContractResponse2, rpcContractResponse4 } from '../packages/taquito-michelson-encoder/data/sample19_sapling';
import { rpcContractResponse, rpcContractResponse4 } from '../packages/taquito-michelson-encoder/data/sample19_sapling';
import { Protocols } from "@taquito/taquito";

CONFIGS().forEach(({ lib, rpc, protocol, setup, }) => {
const Tezos = lib;

const edonet = (protocol === Protocols.PtEdoTez) ? test : test.skip;
const edonet = (protocol === Protocols.PtEdo27k) ? test : test.skip;

describe(`Test origination of contracts with sapling using: ${rpc}`, () => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CONFIGS().forEach(({ lib, rpc, setup, protocol }) => {
init: `"Copyright ©"`
})
} catch (ex) {
if( protocol === Protocols.PtEdoTez) {
if( protocol === Protocols.PtEdo27k) {
expect(ex).toEqual(expect.objectContaining({ message: expect.stringContaining('michelson_v1.invalid_syntactic_constant') }))
} else if( protocol === Protocols.PsCARTHA) {
expect(ex).toEqual(expect.objectContaining({ message: expect.stringContaining('invalidSyntacticConstantError') }))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Protocols } from "@taquito/taquito";
CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const Tezos = lib;

const edonet = (protocol === Protocols.PtEdoTez) ? test : test.skip;
const edonet = (protocol === Protocols.PtEdo27k) ? test : test.skip;

describe(`Test origination of a token contract using: ${rpc}`, () => {

Expand Down
21 changes: 14 additions & 7 deletions integration-tests/ledger-signer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CONFIGS } from './config';
import { LedgerSigner, LedgerTransport, DerivationType } from '../packages/taquito-ledger-signer/src/taquito-ledger-signer';
import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
import { ligoSample } from "./data/ligo-simple-contract";
import { TezosToolkit } from '@taquito/taquito';

/**
* LedgerSigner test
Expand All @@ -19,16 +20,16 @@ import { ligoSample } from "./data/ligo-simple-contract";
* 11-twenty
* 12-giant
*/
CONFIGS().forEach(({ lib, setup }) => {
CONFIGS().forEach(({ lib, setup, rpc }) => {
const tezos = lib;

describe('LedgerSigner test', () => {
let transport: LedgerTransport;

beforeEach(async (done) => {
transport = await TransportNodeHid.create();
await setup();
done();
await setup(true);
done();
});

it('RemoteSigner is instantiable with default parameters', () => {
Expand Down Expand Up @@ -135,14 +136,19 @@ CONFIGS().forEach(({ lib, setup }) => {
describe('Should be abble to use Ledger with contract API', () => {
jest.setTimeout(60000)
it('Should originate contract with Ledger', async (done) => {

const fundAccountFirst = await tezos.contract.transfer({ to: 'tz1e42w8ZaGAbM3gucbBy8iRypdbnqUj7oWY', amount: 9 });
await fundAccountFirst.confirmation();

const signer = new LedgerSigner(
transport,
"44'/1729'/0'/0'",
false,
DerivationType.ED25519
);
tezos.setSignerProvider(signer);
const op = await tezos.contract.originate({
const Tezos = new TezosToolkit(rpc);
Tezos.setSignerProvider(signer);
const op = await Tezos.contract.originate({
balance: "1",
code: ligoSample,
storage: 0,
Expand All @@ -164,8 +170,9 @@ CONFIGS().forEach(({ lib, setup }) => {
false,
DerivationType.ED25519
);
tezos.setSignerProvider(signer);
const op = await tezos.wallet.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.1 }).send()
const Tezos = new TezosToolkit(rpc);
Tezos.setSignerProvider(signer);
const op = await Tezos.wallet.transfer({ to: 'tz1ZfrERcALBwmAqwonRXYVQBDT9BjNjBHJu', amount: 0.1 }).send()
await op.confirmation()
expect(op.opHash).toBeDefined();
done();
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/wallet-originate-contract-unpair.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -48,7 +48,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -74,7 +74,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -97,7 +97,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -120,7 +120,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand All @@ -146,7 +146,7 @@ CONFIGS().forEach(({ lib, rpc, protocol, setup }) => {
const code: any = contract.script.code.find((x: any) => x.prim === 'code');
const instUnpair = code.args[0].find((x: any) => x.prim === 'UNPAIR');

if (protocol === Protocols.PtEdoTez) {
if (protocol === Protocols.PtEdo27k) {
expect(instUnpair).toBeDefined();
} else {
expect(instUnpair).toBeUndefined();
Expand Down
Loading

0 comments on commit df652b3

Please sign in to comment.