-
Notifications
You must be signed in to change notification settings - Fork 9
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
39d110e
commit b9deab4
Showing
15 changed files
with
326 additions
and
57 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,4 +1,5 @@ | ||
# Logs | ||
__pycache__ | ||
.DS_Store | ||
logs | ||
*.log | ||
|
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 @@ | ||
../../ts-packages/transform/bin/.bin/ask ./counter.ts --use abort= --runtime stub --target release |
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,34 @@ | ||
@storage | ||
class Stored { | ||
value: u32; | ||
} | ||
|
||
@contract | ||
class Incrementer { | ||
private stored: Stored; | ||
|
||
constructor() { | ||
chain.sayHello(); | ||
this.stored = new Stored(); | ||
} | ||
|
||
@constructor | ||
default(initValue: u32): void { | ||
//this.stored.value = initValue; | ||
} | ||
|
||
@message | ||
inc(): void { | ||
// let v = this.stored.value; | ||
// this.stored.value = ++v; | ||
} | ||
|
||
@message(mutates = false) | ||
get(): u32 { | ||
return this.stored.value; | ||
} | ||
|
||
apply(receiver: u64, firstReceiver: u64, action: u64): void { | ||
chain.sayHello(); | ||
} | ||
} |
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,21 @@ | ||
import os | ||
import sys | ||
import json | ||
|
||
test_dir = os.path.dirname(__file__) | ||
sys.path.append(os.path.join(test_dir, '..')) | ||
|
||
from ipyeos import log | ||
from ipyeos.chaintester import ChainTester | ||
|
||
logger = log.get_logger(__name__) | ||
|
||
chain = ChainTester() | ||
|
||
def test_ts(): | ||
# info = chain.get_account('helloworld11') | ||
# logger.info(info) | ||
with open('./target/target.wasm', 'rb') as f: | ||
code = f.read() | ||
chain.deploy_contract('hello', code, b'', 0) | ||
r = chain.push_action('hello', 'test', b'goodbye,world', {'hello': 'active'}) |
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 @@ | ||
run-ipyeos -m pytest -s -x test.py -k test_ts |
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
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 |
---|---|---|
@@ -1,10 +1,20 @@ | ||
export const storeTpl = `{{export}}class {{className}} { | ||
export const storeTpl = `{{export}}class {{className}} extends chain.Serializer { | ||
{{#each fields}} | ||
private {{varName}}: {{{type.plainTypeNode}}} | null = null; | ||
private {{name}}: {{{type.plainType}}}; | ||
{{/each}} | ||
{{#each fields}} | ||
{{{storeGetter .}}} | ||
{{{storeSetter .}}} | ||
{{/each}} | ||
serialize(): u8[] { | ||
let enc = new chain.Encoder(10); | ||
{{#each fields}} | ||
{{{serialize .}}} | ||
{{/each}} | ||
return enc.getBytes(); | ||
} | ||
deserialize(data: u8[]): void { | ||
let dec = new chain.Decoder(data); | ||
{{#each fields}} | ||
{{{deserialize .}}} | ||
{{/each}} | ||
} | ||
}`; |
Oops, something went wrong.