@algorandfoundation/algorand-typescript-testing 1.0.0-alpha.7 → 1.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/impl/crypto.d.ts +5 -5
- package/impl/pure.d.ts +2 -2
- package/index.mjs +46 -5
- package/index.mjs.map +1 -1
- package/package.json +7 -3
- package/runtime-helpers-C_HAST0y.js.map +1 -1
- package/test-transformer/index.mjs +125 -44
- package/test-transformer/index.mjs.map +1 -1
- package/test-transformer/node-factory.d.ts +1 -0
- package/test-transformer/supported-binary-op-string.d.ts +1 -0
- package/typescript-helpers.d.ts +3 -0
package/impl/crypto.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { bytes, internal } from '@algorandfoundation/algorand-typescript';
|
|
1
|
+
import { bytes, Ecdsa, internal, VrfVerify } from '@algorandfoundation/algorand-typescript';
|
|
2
2
|
export declare const sha256: (a: internal.primitives.StubBytesCompat) => bytes;
|
|
3
3
|
export declare const sha3_256: (a: internal.primitives.StubBytesCompat) => bytes;
|
|
4
4
|
export declare const keccak256: (a: internal.primitives.StubBytesCompat) => bytes;
|
|
5
5
|
export declare const sha512_256: (a: internal.primitives.StubBytesCompat) => bytes;
|
|
6
6
|
export declare const ed25519verifyBare: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat, c: internal.primitives.StubBytesCompat) => boolean;
|
|
7
7
|
export declare const ed25519verify: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat, c: internal.primitives.StubBytesCompat) => boolean;
|
|
8
|
-
export declare const ecdsaVerify: (v:
|
|
9
|
-
export declare const ecdsaPkRecover: (v:
|
|
10
|
-
export declare const ecdsaPkDecompress: (v:
|
|
11
|
-
export declare const vrfVerify: (_s:
|
|
8
|
+
export declare const ecdsaVerify: (v: Ecdsa, a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat, c: internal.primitives.StubBytesCompat, d: internal.primitives.StubBytesCompat, e: internal.primitives.StubBytesCompat) => boolean;
|
|
9
|
+
export declare const ecdsaPkRecover: (v: Ecdsa, a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubBytesCompat, d: internal.primitives.StubBytesCompat) => readonly [bytes, bytes];
|
|
10
|
+
export declare const ecdsaPkDecompress: (v: Ecdsa, a: internal.primitives.StubBytesCompat) => readonly [bytes, bytes];
|
|
11
|
+
export declare const vrfVerify: (_s: VrfVerify, _a: internal.primitives.StubBytesCompat, _b: internal.primitives.StubBytesCompat, _c: internal.primitives.StubBytesCompat) => readonly [bytes, boolean];
|
|
12
12
|
export declare const EllipticCurve: internal.opTypes.EllipticCurveType;
|
package/impl/pure.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { biguint, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
1
|
+
import { Base64, biguint, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
2
2
|
export declare const addw: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => readonly [uint64, uint64];
|
|
3
|
-
export declare const base64Decode: (e:
|
|
3
|
+
export declare const base64Decode: (e: Base64, a: internal.primitives.StubBytesCompat) => bytes;
|
|
4
4
|
export declare const bitLength: (a: internal.primitives.StubUint64Compat | internal.primitives.StubBytesCompat) => uint64;
|
|
5
5
|
export declare const bsqrt: (a: internal.primitives.StubBigUintCompat) => biguint;
|
|
6
6
|
export declare const btoi: (a: internal.primitives.StubBytesCompat) => uint64;
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { internal, Bytes, Uint64, Account, arc4, op, TransactionType, Asset, Application, BigUint, BaseContract, Contract } from '@algorandfoundation/algorand-typescript';
|
|
1
|
+
import { internal, Bytes, Uint64, Account, Ecdsa, arc4, op, Base64, TransactionType, Asset, Application, BigUint, BaseContract, Contract } from '@algorandfoundation/algorand-typescript';
|
|
2
2
|
import algosdk from 'algosdk';
|
|
3
3
|
import { a as asMaybeUint64Cls, b as asUint64, c as asBytes, d as asNumber, M as MAX_BOX_SIZE, t as toBytes, e as asBytesCls, f as asUint8Array, g as conactUint8Arrays, L as LOGIC_DATA_PREFIX, h as asBigInt, i as getObjectReference, j as MIN_TXN_FEE, D as DEFAULT_ACCOUNT_MIN_BALANCE, k as DEFAULT_MAX_TXN_LIFE, Z as ZERO_ADDRESS, l as DEFAULT_ASSET_CREATE_MIN_BALANCE, m as DEFAULT_ASSET_OPT_IN_MIN_BALANCE, n as DEFAULT_GLOBAL_GENESIS_HASH, o as asUint64Cls, p as asMaybeBytesCls, q as asBigUint, B as BITS_IN_BYTE, r as MAX_BYTES_SIZE, s as MAX_UINT8, u as binaryStringToBytes, U as UINT64_SIZE, v as MAX_UINT64, w as Uint64BackedCls, A as ALWAYS_APPROVE_TEAL_PROGRAM, x as BytesBackedCls, y as combineIntoMaxBytePages, z as MAX_ITEMS_IN_LOG, C as ABI_RETURN_VALUE_LOG_PREFIX, E as getRandomBytes, F as getGenericTypeInfo, G as getAbiMetadata, H as iterBigInt, I as getRandomBigInt, J as captureMethodConfig } from './runtime-helpers-C_HAST0y.js';
|
|
4
4
|
import { ec } from 'elliptic';
|
|
@@ -129,6 +129,16 @@ const AcctParams = {
|
|
|
129
129
|
const acct = getAccount(a);
|
|
130
130
|
return [acct.totalBoxBytes, acct.balance !== 0];
|
|
131
131
|
},
|
|
132
|
+
// TODO: implement v11 methods
|
|
133
|
+
acctIncentiveEligible: function (_a) {
|
|
134
|
+
throw new Error('Function not implemented.');
|
|
135
|
+
},
|
|
136
|
+
acctLastProposed: function (_a) {
|
|
137
|
+
throw new Error('Function not implemented.');
|
|
138
|
+
},
|
|
139
|
+
acctLastHeartbeat: function (_a) {
|
|
140
|
+
throw new Error('Function not implemented.');
|
|
141
|
+
},
|
|
132
142
|
};
|
|
133
143
|
|
|
134
144
|
const resolveAppIndex = (appIdOrIndex) => {
|
|
@@ -554,7 +564,7 @@ const ecdsaVerify = (v, a, b, c, d, e) => {
|
|
|
554
564
|
return keyPair.verify(dataBytes.asUint8Array(), { r: sigRBytes.asUint8Array(), s: sigSBytes.asUint8Array() });
|
|
555
565
|
};
|
|
556
566
|
const ecdsaPkRecover = (v, a, b, c, d) => {
|
|
557
|
-
if (v !==
|
|
567
|
+
if (v !== Ecdsa.Secp256k1) {
|
|
558
568
|
internal.errors.internalError(`Unsupported ECDSA curve: ${v}`);
|
|
559
569
|
}
|
|
560
570
|
const dataBytes = internal.primitives.BytesCls.fromCompat(a);
|
|
@@ -585,8 +595,8 @@ const EllipticCurve = new Proxy({}, {
|
|
|
585
595
|
},
|
|
586
596
|
});
|
|
587
597
|
const curveMap = {
|
|
588
|
-
[
|
|
589
|
-
[
|
|
598
|
+
[Ecdsa.Secp256k1]: 'secp256k1',
|
|
599
|
+
[Ecdsa.Secp256r1]: 'p256',
|
|
590
600
|
};
|
|
591
601
|
|
|
592
602
|
class GlobalData {
|
|
@@ -748,6 +758,12 @@ const Global = {
|
|
|
748
758
|
get genesisHash() {
|
|
749
759
|
return getGlobalData().genesisHash;
|
|
750
760
|
},
|
|
761
|
+
payoutsEnabled: false,
|
|
762
|
+
// TODO: implement v11 fields
|
|
763
|
+
payoutsGoOnlineFee: 0,
|
|
764
|
+
payoutsPercent: 0,
|
|
765
|
+
payoutsMinBalance: 0,
|
|
766
|
+
payoutsMaxBalance: 0,
|
|
751
767
|
};
|
|
752
768
|
|
|
753
769
|
const GTxn = {
|
|
@@ -1778,7 +1794,7 @@ const addw = (a, b) => {
|
|
|
1778
1794
|
return toUint128(sum);
|
|
1779
1795
|
};
|
|
1780
1796
|
const base64Decode = (e, a) => {
|
|
1781
|
-
const encoding = e ===
|
|
1797
|
+
const encoding = e === Base64.StdEncoding ? 'base64' : 'base64url';
|
|
1782
1798
|
const bytesValue = internal.primitives.BytesCls.fromCompat(a);
|
|
1783
1799
|
const stringValue = bytesValue.toString();
|
|
1784
1800
|
const bufferResult = Buffer.from(stringValue, encoding);
|
|
@@ -2085,6 +2101,31 @@ const Block = {
|
|
|
2085
2101
|
blkTimestamp: function (a) {
|
|
2086
2102
|
return asUint64(lazyContext.ledger.getBlockContent(a).timestamp);
|
|
2087
2103
|
},
|
|
2104
|
+
// TODO: implement v11 methods
|
|
2105
|
+
blkProposer: function (_a) {
|
|
2106
|
+
throw new Error('Function not implemented.');
|
|
2107
|
+
},
|
|
2108
|
+
blkFeesCollected: function (_a) {
|
|
2109
|
+
throw new Error('Function not implemented.');
|
|
2110
|
+
},
|
|
2111
|
+
blkBonus: function (_a) {
|
|
2112
|
+
throw new Error('Function not implemented.');
|
|
2113
|
+
},
|
|
2114
|
+
blkBranch: function (_a) {
|
|
2115
|
+
throw new Error('Function not implemented.');
|
|
2116
|
+
},
|
|
2117
|
+
blkFeeSink: function (_a) {
|
|
2118
|
+
throw new Error('Function not implemented.');
|
|
2119
|
+
},
|
|
2120
|
+
blkProtocol: function (_a) {
|
|
2121
|
+
throw new Error('Function not implemented.');
|
|
2122
|
+
},
|
|
2123
|
+
blkTxnCounter: function (_a) {
|
|
2124
|
+
throw new Error('Function not implemented.');
|
|
2125
|
+
},
|
|
2126
|
+
blkProposerPayout: function (_a) {
|
|
2127
|
+
throw new Error('Function not implemented.');
|
|
2128
|
+
},
|
|
2088
2129
|
};
|
|
2089
2130
|
|
|
2090
2131
|
const gaid = (a) => {
|