-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from RomarQ/rq@distribution-tests
build: Reuse smartML.js on multiple bundles and adds a test for es6 i…
- Loading branch information
Showing
13 changed files
with
164 additions
and
68 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
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,3 +1,5 @@ | ||
yarn-error.log | ||
|
||
# Coverage report | ||
coverage | ||
|
||
|
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
// Load polyfills needed by SmartML | ||
import './smartml/polyfills'; | ||
|
||
export * as CompilerAPI from './smartml'; | ||
export * from './core'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import assert from 'assert'; | ||
|
||
import SmartTS from '@tezwell/smartts-sdk'; | ||
const { | ||
Contract, | ||
EntryPoint, | ||
Address, | ||
Nat, | ||
String, | ||
TNat, | ||
DefineVar, | ||
Require, | ||
SetValue, | ||
ContractStorage, | ||
Equal, | ||
GetLocal, | ||
GetSender, | ||
} = SmartTS; | ||
import SmartML from '@tezwell/smartts-sdk/smartml'; | ||
|
||
const contract = new Contract() | ||
.setStorage(Nat(0)) | ||
.addEntrypoint( | ||
new EntryPoint('ep1').inputType(TNat).code((arg) => [ | ||
// Define a variable named "some_address" | ||
DefineVar('some_address', Address('tz1')), | ||
// Require sender to be equal to variable "some_address", otherwise fail with "Not Admin!" | ||
Require(Equal(GetLocal('some_address'), GetSender()), String('Not Admin!')), | ||
// Replace the storage value with entry point argument | ||
SetValue(ContractStorage(), arg), | ||
]), | ||
) | ||
.toString(); | ||
|
||
assert.deepEqual(SmartML.default.compileContract(contract), [ | ||
{ | ||
prim: 'storage', | ||
args: [ | ||
{ | ||
prim: 'nat', | ||
}, | ||
], | ||
}, | ||
{ | ||
prim: 'parameter', | ||
args: [ | ||
{ | ||
prim: 'nat', | ||
annots: ['%ep1'], | ||
}, | ||
], | ||
}, | ||
{ | ||
prim: 'code', | ||
args: [ | ||
[ | ||
{ | ||
prim: 'CAR', | ||
}, | ||
{ | ||
prim: 'PUSH', | ||
args: [ | ||
{ | ||
prim: 'address', | ||
}, | ||
{ | ||
string: 'tz1', | ||
}, | ||
], | ||
}, | ||
{ | ||
prim: 'SENDER', | ||
}, | ||
{ | ||
prim: 'COMPARE', | ||
}, | ||
{ | ||
prim: 'EQ', | ||
}, | ||
{ | ||
prim: 'IF', | ||
args: [ | ||
[], | ||
[ | ||
{ | ||
prim: 'PUSH', | ||
args: [ | ||
{ | ||
prim: 'string', | ||
}, | ||
{ | ||
string: 'Not Admin!', | ||
}, | ||
], | ||
}, | ||
{ | ||
prim: 'FAILWITH', | ||
}, | ||
], | ||
], | ||
}, | ||
{ | ||
prim: 'NIL', | ||
args: [ | ||
{ | ||
prim: 'operation', | ||
}, | ||
], | ||
}, | ||
{ | ||
prim: 'PAIR', | ||
}, | ||
], | ||
], | ||
}, | ||
]); | ||
|
||
console.info('[Passes] - ESM'); |
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