Skip to content

Commit

Permalink
fix: Export paths for algorand-typescript package
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Oct 16, 2024
1 parent f444d67 commit daf87de
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 38 deletions.
9 changes: 5 additions & 4 deletions packages/algo-ts/.tstoolkitrc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TsToolkitConfig } from "@makerx/ts-toolkit";
import type { TsToolkitConfig } from '@makerx/ts-toolkit'

const config: TsToolkitConfig = {
packageConfig: {
Expand All @@ -7,9 +7,10 @@ const config: TsToolkitConfig = {
moduleType: 'module',
main: 'index.ts',
exports: {
'.': "index.ts",
'./arc4': "arc4/index.ts"
'.': 'index.ts',
'./arc4': 'arc4/index.ts',
'./op': 'op.ts',
},
}
},
}
export default config
2 changes: 1 addition & 1 deletion packages/algo-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@algorandfoundation/algorand-typescript",
"version": "0.0.1-alpha.9",
"version": "0.0.1-alpha.10",
"description": "This package contains definitions for the types which comprise Algorand TypeScript which can be compiled to run on the Algorand Virtual Machine using the Puya compiler.",
"private": false,
"main": "index.js",
Expand Down
6 changes: 5 additions & 1 deletion packages/algo-ts/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import typescript from '@rollup/plugin-typescript'
import type { RollupOptions } from 'rollup'

const config: RollupOptions = {
input: ['src/index.ts', 'src/arc4/index.ts'],
input: {
index: 'src/index.ts',
'arc4/index': 'src/arc4/index.ts',
op: 'src/op.ts',
},
output: [
{
dir: 'dist',
Expand Down
4 changes: 4 additions & 0 deletions tests/approvals/intrinsic-calls.algo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import type { bytes, uint64 } from '@algorandfoundation/algorand-typescript'
import { op } from '@algorandfoundation/algorand-typescript'
import { itob, sha256 } from '@algorandfoundation/algorand-typescript/op'

function test(a: uint64, b: bytes) {
const x = op.setBit(a, 8, 1)
const y = op.setBit(b, 12, 9)

const z = itob(x)
const g = sha256(z)
}
2 changes: 2 additions & 0 deletions tests/approvals/out/intrinsic-calls.awst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ subroutine test(a: uint64, b: bytes): void
{
x: uint64 = setbit(a, 8, 1)
y: bytes = setbit(b, 12, 9)
z: bytes = itob(x)
g: bytes = sha256(z)
}
200 changes: 168 additions & 32 deletions tests/approvals/out/intrinsic-calls.awst.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"_type": "Subroutine",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 4,
"end_line": 7,
"line": 5,
"end_line": 11,
"column": 0,
"end_column": 1
},
Expand All @@ -21,8 +21,8 @@
},
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 4,
"end_line": 4,
"line": 5,
"end_line": 5,
"column": 14,
"end_column": 23
}
Expand All @@ -39,8 +39,8 @@
},
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 4,
"end_line": 4,
"line": 5,
"end_line": 5,
"column": 25,
"end_column": 33
}
Expand All @@ -57,8 +57,8 @@
"_type": "Block",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 4,
"end_line": 7,
"line": 5,
"end_line": 11,
"column": 35,
"end_column": 1
},
Expand All @@ -67,17 +67,17 @@
"_type": "AssignmentStatement",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 5,
"end_line": 5,
"line": 6,
"end_line": 6,
"column": 8,
"end_column": 30
},
"target": {
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 5,
"end_line": 5,
"line": 6,
"end_line": 6,
"column": 8,
"end_column": 9
},
Expand All @@ -94,8 +94,8 @@
"_type": "IntrinsicCall",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 5,
"end_line": 5,
"line": 6,
"end_line": 6,
"column": 12,
"end_column": 30
},
Expand All @@ -113,8 +113,8 @@
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 5,
"end_line": 5,
"line": 6,
"end_line": 6,
"column": 22,
"end_column": 23
},
Expand All @@ -131,8 +131,8 @@
"_type": "IntegerConstant",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 5,
"end_line": 5,
"line": 6,
"end_line": 6,
"column": 25,
"end_column": 26
},
Expand All @@ -150,8 +150,8 @@
"_type": "IntegerConstant",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 5,
"end_line": 5,
"line": 6,
"end_line": 6,
"column": 28,
"end_column": 29
},
Expand All @@ -173,17 +173,17 @@
"_type": "AssignmentStatement",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 6,
"end_line": 6,
"line": 7,
"end_line": 7,
"column": 8,
"end_column": 31
},
"target": {
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 6,
"end_line": 6,
"line": 7,
"end_line": 7,
"column": 8,
"end_column": 9
},
Expand All @@ -200,8 +200,8 @@
"_type": "IntrinsicCall",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 6,
"end_line": 6,
"line": 7,
"end_line": 7,
"column": 12,
"end_column": 31
},
Expand All @@ -219,8 +219,8 @@
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 6,
"end_line": 6,
"line": 7,
"end_line": 7,
"column": 22,
"end_column": 23
},
Expand All @@ -237,8 +237,8 @@
"_type": "IntegerConstant",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 6,
"end_line": 6,
"line": 7,
"end_line": 7,
"column": 25,
"end_column": 27
},
Expand All @@ -256,8 +256,8 @@
"_type": "IntegerConstant",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 6,
"end_line": 6,
"line": 7,
"end_line": 7,
"column": 29,
"end_column": 30
},
Expand All @@ -274,6 +274,142 @@
],
"comment": null
}
},
{
"_type": "AssignmentStatement",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 9,
"end_line": 9,
"column": 8,
"end_column": 19
},
"target": {
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 9,
"end_line": 9,
"column": 8,
"end_column": 9
},
"wtype": {
"_type": "WType",
"name": "bytes",
"immutable": true,
"ephemeral": false,
"scalar_type": 1
},
"name": "z"
},
"value": {
"_type": "IntrinsicCall",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 9,
"end_line": 9,
"column": 12,
"end_column": 19
},
"wtype": {
"_type": "WType",
"name": "bytes",
"immutable": true,
"ephemeral": false,
"scalar_type": 1
},
"op_code": "itob",
"immediates": [],
"stack_args": [
{
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 9,
"end_line": 9,
"column": 17,
"end_column": 18
},
"wtype": {
"_type": "WType",
"name": "uint64",
"immutable": true,
"ephemeral": false,
"scalar_type": 2
},
"name": "x"
}
],
"comment": null
}
},
{
"_type": "AssignmentStatement",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 10,
"end_line": 10,
"column": 8,
"end_column": 21
},
"target": {
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 10,
"end_line": 10,
"column": 8,
"end_column": 9
},
"wtype": {
"_type": "WType",
"name": "bytes",
"immutable": true,
"ephemeral": false,
"scalar_type": 1
},
"name": "g"
},
"value": {
"_type": "IntrinsicCall",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 10,
"end_line": 10,
"column": 12,
"end_column": 21
},
"wtype": {
"_type": "WType",
"name": "bytes",
"immutable": true,
"ephemeral": false,
"scalar_type": 1
},
"op_code": "sha256",
"immediates": [],
"stack_args": [
{
"_type": "VarExpression",
"source_location": {
"file": "tests/approvals/intrinsic-calls.algo.ts",
"line": 10,
"end_line": 10,
"column": 19,
"end_column": 20
},
"wtype": {
"_type": "WType",
"name": "bytes",
"immutable": true,
"ephemeral": false,
"scalar_type": 1
},
"name": "z"
}
],
"comment": null
}
}
],
"label": null,
Expand Down

0 comments on commit daf87de

Please sign in to comment.