@algorandfoundation/algorand-typescript 0.0.1-alpha.1

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/op.d.ts ADDED
@@ -0,0 +1,55 @@
1
+ import { AddwType, BalanceType, Base64DecodeType, BitLengthType, BsqrtType, BtoiType, BzeroType, ConcatType, DivmodwType, DivwType, EcdsaPkDecompressType, EcdsaPkRecoverType, EcdsaVerifyType, Ed25519verifyBareType, Ed25519verifyType, EllipticCurveType, ExpType, ExpwType, ExtractType, ExtractUint16Type, ExtractUint32Type, ExtractUint64Type, GaidType, GetBitType, GetByteType, GITxnType, GlobalType, GTxnType, ItobType, ITxnCreateType, ITxnType, JsonRefType, Keccak256Type, MulwType, ReplaceType, ScratchType, SelectType, SetBitType, SetByteType, Sha256Type, Sha3_256Type, Sha512_256Type, ShlType, ShrType, SqrtType, SubstringType, TxnType, VrfVerifyType } from './op-types';
2
+ export declare const addw: AddwType;
3
+ export declare const balance: BalanceType;
4
+ export declare const base64Decode: Base64DecodeType;
5
+ export declare const bitLength: BitLengthType;
6
+ export declare const bsqrt: BsqrtType;
7
+ export declare const btoi: BtoiType;
8
+ export declare const bzero: BzeroType;
9
+ export declare const concat: ConcatType;
10
+ export declare const divmodw: DivmodwType;
11
+ export declare const divw: DivwType;
12
+ export declare const ecdsaPkDecompress: EcdsaPkDecompressType;
13
+ export declare const ecdsaPkRecover: EcdsaPkRecoverType;
14
+ export declare const ecdsaVerify: EcdsaVerifyType;
15
+ export declare const ed25519verifyBare: Ed25519verifyBareType;
16
+ export declare const ed25519verify: Ed25519verifyType;
17
+ export declare const exp: ExpType;
18
+ export declare const expw: ExpwType;
19
+ export declare const extract: ExtractType;
20
+ export declare const extractUint16: ExtractUint16Type;
21
+ export declare const extractUint32: ExtractUint32Type;
22
+ export declare const extractUint64: ExtractUint64Type;
23
+ export declare const gaid: GaidType;
24
+ export declare const getBit: GetBitType;
25
+ export declare const getByte: GetByteType;
26
+ export declare const itob: ItobType;
27
+ export declare const keccak256: Keccak256Type;
28
+ export declare const minBalance: BalanceType;
29
+ export declare const mulw: MulwType;
30
+ export declare const replace: ReplaceType;
31
+ export declare const select: SelectType;
32
+ export declare const setBit: SetBitType;
33
+ export declare const setByte: SetByteType;
34
+ export declare const sha256: Sha256Type;
35
+ export declare const sha3_256: Sha3_256Type;
36
+ export declare const sha512_256: Sha512_256Type;
37
+ export declare const shl: ShlType;
38
+ export declare const shr: ShrType;
39
+ export declare const sqrt: SqrtType;
40
+ export declare const substring: SubstringType;
41
+ export declare const vrfVerify: VrfVerifyType;
42
+ export declare const EllipticCurve: EllipticCurveType;
43
+ export declare const Global: GlobalType;
44
+ export declare const GTxn: GTxnType;
45
+ export declare const JsonRef: JsonRefType;
46
+ export declare const Txn: TxnType;
47
+ export declare const GITxn: GITxnType;
48
+ export declare const ITxn: ITxnType;
49
+ export declare const ITxnCreate: ITxnCreateType;
50
+ export declare const Scratch: ScratchType;
51
+ export declare const AcctParams: import("./op-types").AcctParamsType;
52
+ export declare const AppParams: import("./op-types").AppParamsType;
53
+ export declare const AssetHolding: import("./op-types").AssetHoldingType;
54
+ export declare const AssetParams: import("./op-types").AssetParamsType;
55
+ export { VrfVerify } from './op-types';
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "scripts": {},
3
+ "files": [
4
+ "**"
5
+ ],
6
+ "name": "@algorandfoundation/algorand-typescript",
7
+ "version": "0.0.1-alpha.1",
8
+ "description": "",
9
+ "private": false,
10
+ "overrides": {
11
+ "micromatch": "4.0.8"
12
+ },
13
+ "peerDependencies": {
14
+ "tslib": "^2.6.2"
15
+ },
16
+ "main": "./index.js",
17
+ "module": "./index.mjs",
18
+ "types": "./index.d.ts",
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./index.d.ts",
23
+ "import": "./index.mjs",
24
+ "require": "./index.js"
25
+ },
26
+ "./arc4": {
27
+ "types": "./arc4/index.d.ts",
28
+ "import": "./arc4/index.mjs",
29
+ "require": "./arc4/index.js"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,55 @@
1
+ export type Uint64Compat = uint64 | bigint | boolean | number;
2
+ export type BigUintCompat = Uint64Compat | bigint | bytes | number;
3
+ export type StringCompat = string;
4
+ export type BytesCompat = bytes | string | Uint8Array;
5
+ /**
6
+ * An unsigned integer of exactly 64 bits
7
+ */
8
+ export type uint64 = {
9
+ __type?: 'uint64';
10
+ } & number;
11
+ /**
12
+ * Create a uint64 value
13
+ * @param v The value to use
14
+ */
15
+ export declare function Uint64(v: bigint): uint64;
16
+ export declare function Uint64(v: number): uint64;
17
+ export declare function Uint64(v: boolean): uint64;
18
+ /**
19
+ * An unsigned integer of up to 512 bits
20
+ *
21
+ * Stored as a big-endian variable byte array
22
+ */
23
+ export type biguint = {
24
+ __type?: 'biguint';
25
+ } & bigint;
26
+ /**
27
+ * Create a biguint value
28
+ * @param v The value to use
29
+ */
30
+ export declare function BigUint(v: bigint): biguint;
31
+ export declare function BigUint(v: boolean): biguint;
32
+ export declare function BigUint(v: number): biguint;
33
+ export declare function BigUint(v: bytes): biguint;
34
+ export type bytes = {
35
+ readonly length: uint64;
36
+ at(i: Uint64Compat): bytes;
37
+ concat(other: BytesCompat): bytes;
38
+ bitwiseAnd(other: BytesCompat): bytes;
39
+ bitwiseOr(other: BytesCompat): bytes;
40
+ bitwiseXor(other: BytesCompat): bytes;
41
+ bitwiseInvert(): bytes;
42
+ equals(other: BytesCompat): boolean;
43
+ toString(): string;
44
+ };
45
+ export declare function Bytes(value: TemplateStringsArray, ...replacements: BytesCompat[]): bytes;
46
+ export declare function Bytes(value: BytesCompat): bytes;
47
+ export declare function Bytes(): bytes;
48
+ export declare namespace Bytes {
49
+ var fromHex: (hex: string) => bytes;
50
+ var fromBase64: (b64: string) => bytes;
51
+ var fromBase32: (b32: string) => bytes;
52
+ }
53
+ export interface BytesBacked {
54
+ get bytes(): bytes;
55
+ }
package/reference.d.ts ADDED
@@ -0,0 +1,207 @@
1
+ import { bytes, uint64 } from './primitives';
2
+ export type Account = {
3
+ readonly bytes: bytes;
4
+ /**
5
+ * Account balance in microalgos
6
+ *
7
+ * Account must be an available resource
8
+ */
9
+ readonly balance: uint64;
10
+ /**
11
+ * Minimum required balance for account, in microalgos
12
+ *
13
+ * Account must be an available resource
14
+ */
15
+ readonly minBalance: uint64;
16
+ /**
17
+ * Address the account is rekeyed to
18
+ *
19
+ * Account must be an available resource
20
+ */
21
+ readonly authAddress: Account;
22
+ /**
23
+ * The total number of uint64 values allocated by this account in Global and Local States.
24
+ *
25
+ * Account must be an available resource
26
+ */
27
+ readonly totalNumUint: uint64;
28
+ /**
29
+ * The total number of byte array values allocated by this account in Global and Local States.
30
+ *
31
+ * Account must be an available resource
32
+ */
33
+ readonly totalNumByteSlice: uint64;
34
+ /**
35
+ * The number of extra app code pages used by this account.
36
+ *
37
+ * Account must be an available resource
38
+ */
39
+ readonly totalExtraAppPages: uint64;
40
+ /**
41
+ * The number of existing apps created by this account.
42
+ *
43
+ * Account must be an available resource
44
+ */
45
+ readonly totalAppsCreated: uint64;
46
+ /**
47
+ * The number of apps this account is opted into.
48
+ *
49
+ * Account must be an available resource
50
+ */
51
+ readonly totalAppsOptedIn: uint64;
52
+ /**
53
+ * The number of existing ASAs created by this account.
54
+ *
55
+ * Account must be an available resource
56
+ */
57
+ readonly totalAssetsCreated: uint64;
58
+ /**
59
+ * The numbers of ASAs held by this account (including ASAs this account created).
60
+ *
61
+ * Account must be an available resource
62
+ */
63
+ readonly totalAssets: uint64;
64
+ /**
65
+ * The number of existing boxes created by this account's app.
66
+ *
67
+ * Account must be an available resource
68
+ */
69
+ readonly totalBoxes: uint64;
70
+ /**
71
+ * The total number of bytes used by this account's app's box keys and values.
72
+ *
73
+ * Account must be an available resource
74
+ */
75
+ readonly totalBoxBytes: uint64;
76
+ /**
77
+ * Returns true if this account is opted in to the specified Asset or Application.
78
+ * Note: Account and Asset/Application must be an available resource
79
+ *
80
+ * @param assetOrApp
81
+ */
82
+ isOptedIn(assetOrApp: Asset | Application): boolean;
83
+ };
84
+ export declare function Account(): Account;
85
+ export declare function Account(address: bytes): Account;
86
+ export declare function Asset(): Asset;
87
+ export declare function Asset(assetId: uint64): Asset;
88
+ /**
89
+ * An Asset on the Algorand network.
90
+ */
91
+ export type Asset = {
92
+ /**
93
+ * Returns the id of the Asset
94
+ */
95
+ readonly id: uint64;
96
+ /**
97
+ * Total number of units of this asset
98
+ */
99
+ readonly total: uint64;
100
+ /**
101
+ * @see AssetParams.Decimals
102
+ */
103
+ readonly decimals: uint64;
104
+ /**
105
+ * Frozen by default or not
106
+ */
107
+ readonly defaultFrozen: boolean;
108
+ /**
109
+ * Asset unit name
110
+ */
111
+ readonly unitName: bytes;
112
+ /**
113
+ * Asset name
114
+ */
115
+ readonly name: bytes;
116
+ /**
117
+ * URL with additional info about the asset
118
+ */
119
+ readonly url: bytes;
120
+ /**
121
+ * Arbitrary commitment
122
+ */
123
+ readonly metadataHash: bytes;
124
+ /**
125
+ * Manager address
126
+ */
127
+ readonly manager: Account;
128
+ /**
129
+ * Reserve address
130
+ */
131
+ readonly reserve: Account;
132
+ /**
133
+ * Freeze address
134
+ */
135
+ readonly freeze: Account;
136
+ /**
137
+ * Clawback address
138
+ */
139
+ readonly clawback: Account;
140
+ /**
141
+ * Creator address
142
+ */
143
+ readonly creator: Account;
144
+ /**
145
+ * Amount of the asset unit held by this account. Fails if the account has not
146
+ * opted in to the asset.
147
+ * Asset and supplied Account must be an available resource
148
+ * @param account Account
149
+ * @return balance: uint64
150
+ */
151
+ balance(account: Account): uint64;
152
+ /**
153
+ * Is the asset frozen or not. Fails if the account has not
154
+ * opted in to the asset.
155
+ * Asset and supplied Account must be an available resource
156
+ * @param account Account
157
+ * @return isFrozen: boolean
158
+ */
159
+ frozen(account: Account): boolean;
160
+ };
161
+ export declare function Application(): Application;
162
+ export declare function Application(applicationId: uint64): Application;
163
+ /**
164
+ * An Application on the Algorand network.
165
+ */
166
+ export type Application = {
167
+ /**
168
+ * The id of this application on the current network
169
+ */
170
+ readonly id: uint64;
171
+ /**
172
+ * Bytecode of Approval Program
173
+ */
174
+ readonly approvalProgram: bytes;
175
+ /**
176
+ * Bytecode of Clear State Program
177
+ */
178
+ readonly clearStateProgram: bytes;
179
+ /**
180
+ * Number of uint64 values allowed in Global State
181
+ */
182
+ readonly globalNumUint: uint64;
183
+ /**
184
+ * Number of byte array values allowed in Global State
185
+ */
186
+ readonly globalNumBytes: uint64;
187
+ /**
188
+ * Number of uint64 values allowed in Local State
189
+ */
190
+ readonly localNumUint: uint64;
191
+ /**
192
+ * Number of byte array values allowed in Local State
193
+ */
194
+ readonly localNumBytes: uint64;
195
+ /**
196
+ * Number of Extra Program Pages of code space
197
+ */
198
+ readonly extraProgramPages: uint64;
199
+ /**
200
+ * Creator address
201
+ */
202
+ readonly creator: Account;
203
+ /**
204
+ * Address for which this application has authority
205
+ */
206
+ readonly address: Account;
207
+ };
package/state.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { bytes } from './primitives';
2
+ import { Account } from './reference';
3
+ /** A value saved in global state */
4
+ export type GlobalState<ValueType> = {
5
+ value: ValueType;
6
+ delete: () => void;
7
+ hasValue: boolean;
8
+ };
9
+ type GlobalStateOptions<ValueType> = {
10
+ key?: bytes | string;
11
+ initialValue?: ValueType;
12
+ };
13
+ /** A single key in global state */
14
+ export declare function GlobalState<ValueType>(options?: GlobalStateOptions<ValueType>): GlobalState<ValueType>;
15
+ /** A value saved in local state */
16
+ export type LocalStateForAccount<ValueType> = {
17
+ value: ValueType;
18
+ hasValue: boolean;
19
+ delete: () => void;
20
+ };
21
+ export type LocalState<ValueType> = {
22
+ (account: Account): LocalStateForAccount<ValueType>;
23
+ };
24
+ /** A single key in local state */
25
+ export declare function LocalState<ValueType>(options?: {
26
+ key?: bytes | string;
27
+ }): LocalState<ValueType>;
28
+ export {};