-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20f3fa0
commit 82cb0ac
Showing
14 changed files
with
160 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import { CONFIGS } from "./config"; | ||
import { tzip16, Tzip16Module, BigMapMetadataNotFound } from '@taquito/tzip16'; | ||
import { tzip16, Tzip16Module, BigMapContractMetadataNotFoundError } from '@taquito/tzip16'; | ||
|
||
CONFIGS().forEach(({ lib, rpc, setup }) => { | ||
const Tezos = lib; | ||
Tezos.addExtension(new Tzip16Module()); | ||
const Tezos = lib; | ||
Tezos.addExtension(new Tzip16Module()); | ||
|
||
describe(`Test contract origination of a Tzip16 non-complaint contract through contract api using: ${rpc}`, () => { | ||
describe(`Test contract origination of a Tzip16 non-complaint contract through contract api using: ${rpc}`, () => { | ||
|
||
beforeEach(async (done) => { | ||
await setup() | ||
done() | ||
}) | ||
it('Verify contract.originate for a simple contract having no metadata and then try to fetch metadata', async (done) => { | ||
beforeEach(async (done) => { | ||
await setup() | ||
done() | ||
}) | ||
it('Verify contract.originate for a simple contract having no metadata and then try to fetch metadata', async (done) => { | ||
|
||
const value = '1234'; | ||
const code = | ||
[{ "prim": "parameter", "args": [{ "prim": "bytes" }] }, | ||
{ "prim": "storage", "args": [{ "prim": "bytes" }] }, | ||
{ | ||
"prim": "code", | ||
"args": | ||
[[{ "prim": "DUP" }, { "prim": "CAR" }, { "prim": "SWAP" }, | ||
{ "prim": "CDR" }, { "prim": "CONCAT" }, | ||
{ "prim": "NIL", "args": [{ "prim": "operation" }] }, | ||
{ "prim": "PAIR" }]] | ||
}]; | ||
const value = '1234'; | ||
const code = | ||
[{ "prim": "parameter", "args": [{ "prim": "bytes" }] }, | ||
{ "prim": "storage", "args": [{ "prim": "bytes" }] }, | ||
{ | ||
"prim": "code", | ||
"args": | ||
[[{ "prim": "DUP" }, { "prim": "CAR" }, { "prim": "SWAP" }, | ||
{ "prim": "CDR" }, { "prim": "CONCAT" }, | ||
{ "prim": "NIL", "args": [{ "prim": "operation" }] }, | ||
{ "prim": "PAIR" }]] | ||
}]; | ||
|
||
const op = await Tezos.contract.originate({ | ||
code: code, | ||
storage: value | ||
}); | ||
await op.confirmation(); | ||
const contractAddress = (await op.contract()).address; | ||
const op = await Tezos.contract.originate({ | ||
code: code, | ||
storage: value | ||
}); | ||
await op.confirmation(); | ||
const contractAddress = (await op.contract()).address; | ||
|
||
const contract = await Tezos.contract.at(contractAddress, tzip16); | ||
try { | ||
await contract.tzip16().getMetadata(); | ||
} catch (ex) { | ||
expect(ex).toBeInstanceOf(BigMapMetadataNotFound); | ||
} | ||
done(); | ||
}); | ||
const contract = await Tezos.contract.at(contractAddress, tzip16); | ||
try { | ||
await contract.tzip16().getMetadata(); | ||
} catch (ex) { | ||
expect(ex).toBeInstanceOf(BigMapContractMetadataNotFoundError); | ||
} | ||
done(); | ||
}); | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import { CONFIGS } from "./config"; | ||
import { tzip16, Tzip16Module, BigMapMetadataNotFound } from '@taquito/tzip16'; | ||
import { tzip16, Tzip16Module, BigMapContractMetadataNotFoundError } from '@taquito/tzip16'; | ||
|
||
CONFIGS().forEach(({ lib, rpc, setup }) => { | ||
const Tezos = lib; | ||
Tezos.addExtension(new Tzip16Module()); | ||
const Tezos = lib; | ||
Tezos.addExtension(new Tzip16Module()); | ||
|
||
describe(`Test contract origination of a Tzip16 non-complaint contract through wallet api using: ${rpc}`, () => { | ||
describe(`Test contract origination of a Tzip16 non-complaint contract through wallet api using: ${rpc}`, () => { | ||
|
||
beforeEach(async (done) => { | ||
await setup() | ||
done() | ||
}) | ||
it('Verify contract.originate for a simple contract having no metadata and then try to fetch metadata', async (done) => { | ||
beforeEach(async (done) => { | ||
await setup() | ||
done() | ||
}) | ||
it('Verify contract.originate for a simple contract having no metadata and then try to fetch metadata', async (done) => { | ||
|
||
const value = '1234'; | ||
const code = | ||
[{ "prim": "parameter", "args": [{ "prim": "bytes" }] }, | ||
{ "prim": "storage", "args": [{ "prim": "bytes" }] }, | ||
{ | ||
"prim": "code", | ||
"args": | ||
[[{ "prim": "DUP" }, { "prim": "CAR" }, { "prim": "SWAP" }, | ||
{ "prim": "CDR" }, { "prim": "CONCAT" }, | ||
{ "prim": "NIL", "args": [{ "prim": "operation" }] }, | ||
{ "prim": "PAIR" }]] | ||
}]; | ||
const value = '1234'; | ||
const code = | ||
[{ "prim": "parameter", "args": [{ "prim": "bytes" }] }, | ||
{ "prim": "storage", "args": [{ "prim": "bytes" }] }, | ||
{ | ||
"prim": "code", | ||
"args": | ||
[[{ "prim": "DUP" }, { "prim": "CAR" }, { "prim": "SWAP" }, | ||
{ "prim": "CDR" }, { "prim": "CONCAT" }, | ||
{ "prim": "NIL", "args": [{ "prim": "operation" }] }, | ||
{ "prim": "PAIR" }]] | ||
}]; | ||
|
||
const op = await Tezos.wallet.originate({ | ||
code, | ||
storage: value | ||
}).send(); | ||
await op.confirmation(); | ||
const contractAddress = (await op.contract()).address; | ||
const op = await Tezos.wallet.originate({ | ||
code, | ||
storage: value | ||
}).send(); | ||
await op.confirmation(); | ||
const contractAddress = (await op.contract()).address; | ||
|
||
const contract = await Tezos.wallet.at(contractAddress, tzip16); | ||
try { | ||
await contract.tzip16().getMetadata(); | ||
} catch (ex) { | ||
expect(ex).toBeInstanceOf(BigMapMetadataNotFound); | ||
} | ||
done(); | ||
}); | ||
const contract = await Tezos.wallet.at(contractAddress, tzip16); | ||
try { | ||
await contract.tzip16().getMetadata(); | ||
} catch (ex) { | ||
expect(ex).toBeInstanceOf(BigMapContractMetadataNotFoundError); | ||
} | ||
done(); | ||
}); | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.