Skip to content

Commit 95878de

Browse files
authored
Merge pull request #80 from algorandfoundation/native-mutable-types
Native mutable types
2 parents 8571d92 + b37b66c commit 95878de

File tree

94 files changed

+6735
-2821
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6735
-2821
lines changed

.env.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PUYA_PATH="<ABSOLUTE_PATH_TO_PUYA>" # e.g. '/home/parallels/.local/bin/puya'

docs/code/index/functions/toExternalValue.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
> **toExternalValue**(`val`): `bigint`
1212
13-
Defined in: [src/impl/primitives.ts:42](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L42)
13+
Defined in: [src/impl/primitives.ts:43](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L43)
1414

1515
Converts internal Algorand type representations to their external primitive values.
1616

@@ -42,7 +42,7 @@ toExternalValue(bytesVal) // returns Uint8Array([72, 101, 108, 108, 111])
4242

4343
> **toExternalValue**(`val`): `bigint`
4444
45-
Defined in: [src/impl/primitives.ts:43](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L43)
45+
Defined in: [src/impl/primitives.ts:44](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L44)
4646

4747
Converts internal Algorand type representations to their external primitive values.
4848

@@ -74,7 +74,7 @@ toExternalValue(bytesVal) // returns Uint8Array([72, 101, 108, 108, 111])
7474

7575
> **toExternalValue**(`val`): `Uint8Array`
7676
77-
Defined in: [src/impl/primitives.ts:44](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L44)
77+
Defined in: [src/impl/primitives.ts:45](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L45)
7878

7979
Converts internal Algorand type representations to their external primitive values.
8080

@@ -106,7 +106,7 @@ toExternalValue(bytesVal) // returns Uint8Array([72, 101, 108, 108, 111])
106106

107107
> **toExternalValue**(`val`): `string`
108108
109-
Defined in: [src/impl/primitives.ts:45](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L45)
109+
Defined in: [src/impl/primitives.ts:46](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/impl/primitives.ts#L46)
110110

111111
Converts internal Algorand type representations to their external primitive values.
112112

docs/code/subcontexts/contract-context/classes/ContractContext.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: ContractContext
88

9-
Defined in: [src/subcontexts/contract-context.ts:146](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/contract-context.ts#L146)
9+
Defined in: [src/subcontexts/contract-context.ts:162](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/contract-context.ts#L162)
1010

1111
Provides a context for creating contracts and registering created contract instances
1212
with test execution context.
@@ -27,7 +27,7 @@ with test execution context.
2727

2828
> **create**\<`T`\>(`type`, ...`args`): `T`
2929
30-
Defined in: [src/subcontexts/contract-context.ts:158](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/contract-context.ts#L158)
30+
Defined in: [src/subcontexts/contract-context.ts:174](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/contract-context.ts#L174)
3131

3232
Creates a new contract instance and register the created instance with test execution context.
3333

@@ -72,7 +72,7 @@ const contract = ctx.contract.create(MyContract);
7272

7373
> `static` **createMethodCallTxns**\<`TParams`\>(`contract`, `abiMetadata`, ...`args`): `Transaction`[]
7474
75-
Defined in: [src/subcontexts/contract-context.ts:180](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/contract-context.ts#L180)
75+
Defined in: [src/subcontexts/contract-context.ts:196](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/contract-context.ts#L196)
7676

7777
**`Internal`**
7878

docs/code/subcontexts/ledger-context/classes/LedgerContext.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Checks if a box exists for an application by key.
144144

145145
The application.
146146

147-
`Application` | `BaseContract`
147+
`BaseContract` | `Application`
148148

149149
##### key
150150

@@ -174,7 +174,7 @@ Deletes a box for an application by key.
174174

175175
The application.
176176

177-
`Application` | `BaseContract`
177+
`BaseContract` | `Application`
178178

179179
##### key
180180

@@ -364,7 +364,7 @@ Retrieves a box for an application by key.
364364

365365
The application.
366366

367-
`Application` | `BaseContract`
367+
`BaseContract` | `Application`
368368

369369
##### key
370370

@@ -394,7 +394,7 @@ Retrieves global state for an application by key.
394394

395395
The application.
396396

397-
`Application` | `BaseContract`
397+
`BaseContract` | `Application`
398398

399399
##### key
400400

@@ -424,7 +424,7 @@ Retrieves local state for an application and account by key.
424424

425425
The application.
426426

427-
`uint64` | `Application` | `BaseContract`
427+
`uint64` | `BaseContract` | `Application`
428428

429429
##### account
430430

@@ -468,7 +468,7 @@ Retrieves a materialised box for an application by key.
468468

469469
The application.
470470

471-
`Application` | `BaseContract`
471+
`BaseContract` | `Application`
472472

473473
##### key
474474

@@ -658,7 +658,7 @@ Sets a box for an application by key.
658658

659659
The application.
660660

661-
`Application` | `BaseContract`
661+
`BaseContract` | `Application`
662662

663663
##### key
664664

@@ -692,7 +692,7 @@ Sets global state for an application by key.
692692

693693
The application.
694694

695-
`Application` | `BaseContract`
695+
`BaseContract` | `Application`
696696

697697
##### key
698698

@@ -732,7 +732,7 @@ Sets local state for an application and account by key.
732732

733733
The application.
734734

735-
`uint64` | `Application` | `BaseContract`
735+
`uint64` | `BaseContract` | `Application`
736736

737737
##### account
738738

@@ -780,7 +780,7 @@ Cache the materialised box for an application by key.
780780

781781
The application.
782782

783-
`Application` | `BaseContract`
783+
`BaseContract` | `Application`
784784

785785
##### key
786786

docs/code/subcontexts/transaction-context/classes/TransactionGroup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ The payment transaction.
366366

367367
### getScratchSlot()
368368

369-
> **getScratchSlot**(`index`): `bytes` \| `uint64`
369+
> **getScratchSlot**(`index`): `uint64` \| `bytes`
370370
371371
Defined in: [src/subcontexts/transaction-context.ts:293](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/transaction-context.ts#L293)
372372

@@ -382,23 +382,23 @@ The index of the scratch slot.
382382

383383
#### Returns
384384

385-
`bytes` \| `uint64`
385+
`uint64` \| `bytes`
386386

387387
The scratch slot value.
388388

389389
***
390390

391391
### getScratchSpace()
392392

393-
> **getScratchSpace**(): (`bytes` \| `uint64`)[]
393+
> **getScratchSpace**(): (`uint64` \| `bytes`)[]
394394
395395
Defined in: [src/subcontexts/transaction-context.ts:284](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/subcontexts/transaction-context.ts#L284)
396396

397397
Gets the scratch space of the active transaction.
398398

399399
#### Returns
400400

401-
(`bytes` \| `uint64`)[]
401+
(`uint64` \| `bytes`)[]
402402

403403
The scratch space.
404404

docs/code/value-generators/arc4/classes/Arc4ValueGenerator.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ Generate a random dynamic string of size `n` bits.
7575

7676
***
7777

78-
### uintN128()
78+
### uint128()
7979

80-
> **uintN128**(`minValue`, `maxValue`): `UintN128`
80+
> **uint128**(`minValue`, `maxValue`): `Uint128`
8181
8282
Defined in: [src/value-generators/arc4.ts:67](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/value-generators/arc4.ts#L67)
8383

84-
Generate a random UintN128 within the specified range.
84+
Generate a random Uint128 within the specified range.
8585

8686
#### Parameters
8787

@@ -95,17 +95,17 @@ Generate a random UintN128 within the specified range.
9595

9696
#### Returns
9797

98-
`UintN128`
98+
`Uint128`
9999

100100
***
101101

102-
### uintN16()
102+
### uint16()
103103

104-
> **uintN16**(`minValue`, `maxValue`): `UintN16`
104+
> **uint16**(`minValue`, `maxValue`): `Uint16`
105105
106106
Defined in: [src/value-generators/arc4.ts:37](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/value-generators/arc4.ts#L37)
107107

108-
Generate a random UintN16 within the specified range.
108+
Generate a random Uint16 within the specified range.
109109

110110
#### Parameters
111111

@@ -119,17 +119,17 @@ Generate a random UintN16 within the specified range.
119119

120120
#### Returns
121121

122-
`UintN16`
122+
`Uint16`
123123

124124
***
125125

126-
### uintN256()
126+
### uint256()
127127

128-
> **uintN256**(`minValue`, `maxValue`): `UintN256`
128+
> **uint256**(`minValue`, `maxValue`): `Uint256`
129129
130130
Defined in: [src/value-generators/arc4.ts:77](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/value-generators/arc4.ts#L77)
131131

132-
Generate a random UintN256 within the specified range.
132+
Generate a random Uint256 within the specified range.
133133

134134
#### Parameters
135135

@@ -143,17 +143,17 @@ Generate a random UintN256 within the specified range.
143143

144144
#### Returns
145145

146-
`UintN256`
146+
`Uint256`
147147

148148
***
149149

150-
### uintN32()
150+
### uint32()
151151

152-
> **uintN32**(`minValue`, `maxValue`): `UintN32`
152+
> **uint32**(`minValue`, `maxValue`): `Uint32`
153153
154154
Defined in: [src/value-generators/arc4.ts:47](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/value-generators/arc4.ts#L47)
155155

156-
Generate a random UintN32 within the specified range.
156+
Generate a random Uint32 within the specified range.
157157

158158
#### Parameters
159159

@@ -167,17 +167,17 @@ Generate a random UintN32 within the specified range.
167167

168168
#### Returns
169169

170-
`UintN32`
170+
`Uint32`
171171

172172
***
173173

174-
### uintN512()
174+
### uint512()
175175

176-
> **uintN512**(`minValue`, `maxValue`): `UintN`\<`512`\>
176+
> **uint512**(`minValue`, `maxValue`): `Uint`\<`512`\>
177177
178178
Defined in: [src/value-generators/arc4.ts:87](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/value-generators/arc4.ts#L87)
179179

180-
Generate a random UintN512 within the specified range.
180+
Generate a random Uint512 within the specified range.
181181

182182
#### Parameters
183183

@@ -191,17 +191,17 @@ Generate a random UintN512 within the specified range.
191191

192192
#### Returns
193193

194-
`UintN`\<`512`\>
194+
`Uint`\<`512`\>
195195

196196
***
197197

198-
### uintN64()
198+
### uint64()
199199

200-
> **uintN64**(`minValue`, `maxValue`): `UintN64`
200+
> **uint64**(`minValue`, `maxValue`): `Uint64`
201201
202202
Defined in: [src/value-generators/arc4.ts:57](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/value-generators/arc4.ts#L57)
203203

204-
Generate a random UintN64 within the specified range.
204+
Generate a random Uint64 within the specified range.
205205

206206
#### Parameters
207207

@@ -215,17 +215,17 @@ Generate a random UintN64 within the specified range.
215215

216216
#### Returns
217217

218-
`UintN64`
218+
`Uint64`
219219

220220
***
221221

222-
### uintN8()
222+
### uint8()
223223

224-
> **uintN8**(`minValue`, `maxValue`): `UintN8`
224+
> **uint8**(`minValue`, `maxValue`): `Uint8`
225225
226226
Defined in: [src/value-generators/arc4.ts:27](https://github.com/algorandfoundation/algorand-typescript-testing/blob/main/src/value-generators/arc4.ts#L27)
227227

228-
Generate a random UintN8 within the specified range.
228+
Generate a random Uint8 within the specified range.
229229

230230
#### Parameters
231231

@@ -239,4 +239,4 @@ Generate a random UintN8 within the specified range.
239239

240240
#### Returns
241241

242-
`UintN8`
242+
`Uint8`

docs/coverage.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ See which `algorand-typescript` stubs are implemented by the `algorand-typescrip
1616
| CompiledContract | Mockable |
1717
| CompiledLogicSig | Mockable |
1818
| ContractProxy | Mockable |
19+
| FixedArray | Native |
1920
| Global | Emulated |
2021
| GlobalState | Emulated |
2122
| LocalState | Emulated |
2223
| OnCompleteAction | Native |
2324
| OpUpFeeSource | Native |
25+
| ReferenceArray | Native |
2426
| StateTotals | Emulated |
2527
| TemplateVar | Emulated |
2628
| TransactionType | Native |
@@ -32,6 +34,7 @@ See which `algorand-typescript` stubs are implemented by the `algorand-typescrip
3234
| compile | Mockable |
3335
| compileArc4 | Mockable |
3436
| decodeArc4 | Native |
37+
| clone | Native |
3538
| emit | Emulated |
3639
| encodeArc4 | Native |
3740
| ensureBudget | Emulated |
@@ -54,15 +57,14 @@ See which `algorand-typescript` stubs are implemented by the `algorand-typescrip
5457
| arc4.Str | Native |
5558
| arc4.Struct | Native |
5659
| arc4.Tuple | Native |
57-
| arc4.UFixedNxM | Native |
58-
| arc4.UintN | Native |
59-
| arc4.UintN128 | Native |
60-
| arc4.UintN16 | Native |
61-
| arc4.UintN256 | Native |
62-
| arc4.UintN32 | Native |
63-
| arc4.UintN64 | Native |
64-
| arc4.UintN8 | Native |
65-
| arc4.UIntN | Native |
60+
| arc4.UFixed | Native |
61+
| arc4.Uint | Native |
62+
| arc4.Uint128 | Native |
63+
| arc4.Uint16 | Native |
64+
| arc4.Uint256 | Native |
65+
| arc4.Uint32 | Native |
66+
| arc4.Uint64 | Native |
67+
| arc4.Uint8 | Native |
6668
| arc4.abimethod | Emulated |
6769
| arc4.methodSelector | Native |
6870
| arc4.baremethod | Emulated |

0 commit comments

Comments
 (0)