@provablehq/wasm 0.9.4-offline-rc → 0.9.5
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/dist/mainnet/aleo_wasm.d.ts +2359 -1330
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +6817 -3441
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +6826 -3440
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +2359 -1330
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +6817 -3441
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +6826 -3440
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +2 -1
|
@@ -562,6 +562,24 @@ export class EncryptionToolkit {
|
|
|
562
562
|
* @returns {Transition} The decrypted transition.
|
|
563
563
|
*/
|
|
564
564
|
static decryptTransitionWithVk(transition: Transition, transition_vk: Field): Transition;
|
|
565
|
+
/**
|
|
566
|
+
* Decrypts a set of record ciphertexts in parallel and stores successful decryptions.
|
|
567
|
+
*
|
|
568
|
+
* @param {ViewKey} view_key The view key of the owner of the records.
|
|
569
|
+
* @param {Vec<RecordCiphertext>} records The record ciphertexts to decrypt.
|
|
570
|
+
*
|
|
571
|
+
* @returns {vec<RecordPlaintext>} The decrypted record plaintexts.
|
|
572
|
+
*/
|
|
573
|
+
static decryptOwnedRecords(view_key: ViewKey, records: RecordCiphertext[]): RecordPlaintext[];
|
|
574
|
+
/**
|
|
575
|
+
* Checks if a record ciphertext is owned by the given view key.
|
|
576
|
+
*
|
|
577
|
+
* @param {ViewKey} view_key View key of the owner of the records.
|
|
578
|
+
* @param {Vec<RecordCiphertext>} records The record ciphertexts for which to check ownership.
|
|
579
|
+
*
|
|
580
|
+
* @returns {Vec<RecordCiphertext>} The record ciphertexts that are owned by the view key.
|
|
581
|
+
*/
|
|
582
|
+
static checkOwnedRecords(view_key: ViewKey, records: RecordCiphertext[]): RecordCiphertext[];
|
|
565
583
|
}
|
|
566
584
|
/**
|
|
567
585
|
* Execution of an Aleo program.
|
|
@@ -934,1862 +952,2873 @@ export class Group {
|
|
|
934
952
|
*/
|
|
935
953
|
static generator(): Group;
|
|
936
954
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
*/
|
|
940
|
-
export class KeyPair {
|
|
955
|
+
export class I128 {
|
|
956
|
+
private constructor();
|
|
941
957
|
free(): void;
|
|
942
958
|
/**
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
* @param {ProvingKey} proving_key Proving key corresponding to a function in an Aleo program
|
|
946
|
-
* @param {VerifyingKey} verifying_key Verifying key corresponding to a function in an Aleo program
|
|
947
|
-
* @returns {KeyPair} Key pair object containing both the function proving and verifying keys
|
|
959
|
+
* Creates from string.
|
|
948
960
|
*/
|
|
949
|
-
|
|
961
|
+
static fromString(s: string): I128;
|
|
950
962
|
/**
|
|
951
|
-
*
|
|
952
|
-
*
|
|
953
|
-
* @returns {ProvingKey}
|
|
963
|
+
* To string.
|
|
954
964
|
*/
|
|
955
|
-
|
|
965
|
+
toString(): string;
|
|
956
966
|
/**
|
|
957
|
-
*
|
|
958
|
-
*
|
|
959
|
-
* @returns {VerifyingKey}
|
|
967
|
+
* From bytes (LE).
|
|
960
968
|
*/
|
|
961
|
-
|
|
962
|
-
}
|
|
963
|
-
export class Metadata {
|
|
964
|
-
private constructor();
|
|
965
|
-
free(): void;
|
|
966
|
-
static baseUrl(): string;
|
|
967
|
-
static bond_public(): Metadata;
|
|
968
|
-
static bond_validator(): Metadata;
|
|
969
|
-
static claim_unbond_public(): Metadata;
|
|
970
|
-
static fee_private(): Metadata;
|
|
971
|
-
static fee_public(): Metadata;
|
|
972
|
-
static inclusion(): Metadata;
|
|
973
|
-
static join(): Metadata;
|
|
974
|
-
static set_validator_state(): Metadata;
|
|
975
|
-
static split(): Metadata;
|
|
976
|
-
static transfer_private(): Metadata;
|
|
977
|
-
static transfer_private_to_public(): Metadata;
|
|
978
|
-
static transfer_public(): Metadata;
|
|
979
|
-
static transfer_public_as_signer(): Metadata;
|
|
980
|
-
static transfer_public_to_private(): Metadata;
|
|
981
|
-
static unbond_public(): Metadata;
|
|
982
|
-
name: string;
|
|
983
|
-
locator: string;
|
|
984
|
-
prover: string;
|
|
985
|
-
verifier: string;
|
|
986
|
-
verifyingKey: string;
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* An offline query object used to insert the global state root and state paths needed to create
|
|
990
|
-
* a valid inclusion proof offline.
|
|
991
|
-
*/
|
|
992
|
-
export class OfflineQuery {
|
|
993
|
-
free(): void;
|
|
969
|
+
static fromBytesLe(bytes: Uint8Array): I128;
|
|
994
970
|
/**
|
|
995
|
-
*
|
|
996
|
-
*
|
|
997
|
-
* @param {u32} block_height The block height.
|
|
998
|
-
* @param {string} state_root The state root of the current network.
|
|
999
|
-
*
|
|
1000
|
-
* @returns {OfflineQuery} The newly created offline query object.
|
|
971
|
+
* To bytes (LE).
|
|
1001
972
|
*/
|
|
1002
|
-
|
|
973
|
+
toBytesLe(): Uint8Array;
|
|
1003
974
|
/**
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1006
|
-
* @param {u32} block_height The block height to add.
|
|
975
|
+
* From bits.
|
|
1007
976
|
*/
|
|
1008
|
-
|
|
977
|
+
static fromBitsLe(bits: Array<any>): I128;
|
|
1009
978
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
1012
|
-
* @param {string} commitment: The commitment corresponding to a record input.
|
|
1013
|
-
* @param {string} state_path: The state path corresponding to the commitment.
|
|
979
|
+
* To bits.
|
|
1014
980
|
*/
|
|
1015
|
-
|
|
981
|
+
toBitsLe(): Array<any>;
|
|
1016
982
|
/**
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
* @returns {string} JSON string representation of the offline query object.
|
|
983
|
+
* Checked absolute value.
|
|
1020
984
|
*/
|
|
1021
|
-
|
|
985
|
+
absChecked(): I128;
|
|
1022
986
|
/**
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
* @param {string} JSON string representation of the offline query object.
|
|
987
|
+
* Wrapped absolute value.
|
|
1026
988
|
*/
|
|
1027
|
-
|
|
1028
|
-
}
|
|
1029
|
-
export class Pedersen128 {
|
|
1030
|
-
free(): void;
|
|
989
|
+
absWrapped(): I128;
|
|
1031
990
|
/**
|
|
1032
|
-
*
|
|
991
|
+
* Wrapped addition.
|
|
1033
992
|
*/
|
|
1034
|
-
|
|
993
|
+
addWrapped(other: I128): I128;
|
|
1035
994
|
/**
|
|
1036
|
-
*
|
|
995
|
+
* Wrapped subtraction.
|
|
1037
996
|
*/
|
|
1038
|
-
|
|
997
|
+
subWrapped(other: I128): I128;
|
|
1039
998
|
/**
|
|
1040
|
-
*
|
|
999
|
+
* Wrapped multiplication.
|
|
1041
1000
|
*/
|
|
1042
|
-
|
|
1001
|
+
mulWrapped(other: I128): I128;
|
|
1043
1002
|
/**
|
|
1044
|
-
*
|
|
1003
|
+
* Wrapped division.
|
|
1045
1004
|
*/
|
|
1046
|
-
|
|
1005
|
+
divWrapped(other: I128): I128;
|
|
1047
1006
|
/**
|
|
1048
|
-
*
|
|
1007
|
+
* Power to a u8 exponent.
|
|
1049
1008
|
*/
|
|
1050
|
-
|
|
1051
|
-
}
|
|
1052
|
-
export class Pedersen64 {
|
|
1053
|
-
free(): void;
|
|
1009
|
+
powU8(exponent: U8): I128;
|
|
1054
1010
|
/**
|
|
1055
|
-
*
|
|
1011
|
+
* Power to a u16 exponent.
|
|
1056
1012
|
*/
|
|
1057
|
-
|
|
1013
|
+
powU16(exponent: U16): I128;
|
|
1058
1014
|
/**
|
|
1059
|
-
*
|
|
1015
|
+
* Power to a u32 exponent.
|
|
1060
1016
|
*/
|
|
1061
|
-
|
|
1017
|
+
powU32(exponent: U32): I128;
|
|
1062
1018
|
/**
|
|
1063
|
-
*
|
|
1019
|
+
* Negates the integer (e.g., 5 → -5).
|
|
1064
1020
|
*/
|
|
1065
|
-
|
|
1021
|
+
neg(): I128;
|
|
1066
1022
|
/**
|
|
1067
|
-
*
|
|
1023
|
+
* Checks equality with another integer.
|
|
1068
1024
|
*/
|
|
1069
|
-
|
|
1025
|
+
equals(other: I128): boolean;
|
|
1070
1026
|
/**
|
|
1071
|
-
*
|
|
1027
|
+
* Remainder.
|
|
1072
1028
|
*/
|
|
1073
|
-
|
|
1074
|
-
}
|
|
1075
|
-
/**
|
|
1076
|
-
* SnarkVM Plaintext object. Plaintext is a fundamental monadic type used to represent Aleo
|
|
1077
|
-
* primitive types (boolean, field, group, i8, i16, i32, i64, i128, u8, u16, u32, u64, u128,
|
|
1078
|
-
* scalar, and signature), struct types, and array types.
|
|
1079
|
-
*
|
|
1080
|
-
* In the context of a web or NodeJS application, this type is useful for turning an Aleo type into
|
|
1081
|
-
* a JS value, object, or array that might be necessary for performing computations within the
|
|
1082
|
-
* application.
|
|
1083
|
-
*
|
|
1084
|
-
* @example
|
|
1085
|
-
* // Get the bond state of an existing address.
|
|
1086
|
-
* const bondState = await fetch(https://api.explorer.provable.com/v1/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
1087
|
-
* // Convert the bond state to a Plaintext object.
|
|
1088
|
-
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
1089
|
-
* // Convert the Plaintext object to a JS object.
|
|
1090
|
-
* const bondStateObject = bond_state_plaintext.toObject();
|
|
1091
|
-
* // Check if the bond state matches the expected object.
|
|
1092
|
-
* const expectedObject = { validator: "aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f", microcredits: 100000000u64 };
|
|
1093
|
-
* assert( JSON.stringify(bondStateObject) === JSON.stringify(expectedObject) );
|
|
1094
|
-
*/
|
|
1095
|
-
export class Plaintext {
|
|
1096
|
-
private constructor();
|
|
1097
|
-
free(): void;
|
|
1029
|
+
rem(other: I128): I128;
|
|
1098
1030
|
/**
|
|
1099
|
-
*
|
|
1100
|
-
* a struct or the member does not exist.
|
|
1101
|
-
*
|
|
1102
|
-
* @param {string} name The name of the plaintext member to find.
|
|
1103
|
-
*
|
|
1104
|
-
* @returns {Plaintext} The plaintext member.
|
|
1031
|
+
* Wrapped remainder.
|
|
1105
1032
|
*/
|
|
1106
|
-
|
|
1033
|
+
remWrapped(other: I128): I128;
|
|
1107
1034
|
/**
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1110
|
-
* @param {Address} address The address to encrypt the plaintext for.
|
|
1111
|
-
* @param {Scalar} randomizer The randomizer to use for encryption.
|
|
1112
|
-
*
|
|
1113
|
-
* @returns {Ciphertext} The encrypted ciphertext.
|
|
1035
|
+
* Convert to Scalar.
|
|
1114
1036
|
*/
|
|
1115
|
-
|
|
1037
|
+
toScalar(): Scalar;
|
|
1116
1038
|
/**
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
* @param {Field} transition_view_key The transition view key of the transition
|
|
1120
|
-
* associated with the plaintext.
|
|
1121
|
-
*
|
|
1122
|
-
* @returns {Ciphertext} The encrypted ciphertext.
|
|
1039
|
+
* Convert to plaintext.
|
|
1123
1040
|
*/
|
|
1124
|
-
|
|
1041
|
+
toPlaintext(): Plaintext;
|
|
1125
1042
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
* @param {string} plaintext The string representation of the plaintext.
|
|
1129
|
-
*
|
|
1130
|
-
* @returns {Plaintext} The plaintext object.
|
|
1043
|
+
* Convert from Field.
|
|
1131
1044
|
*/
|
|
1132
|
-
static
|
|
1045
|
+
static fromField(field: Field): I128;
|
|
1133
1046
|
/**
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
1137
|
-
*
|
|
1138
|
-
* @returns {Plaintext} The plaintext object.
|
|
1047
|
+
* Convert from Fields.
|
|
1139
1048
|
*/
|
|
1140
|
-
static
|
|
1049
|
+
static fromFields(fields: Array<any>): I128;
|
|
1141
1050
|
/**
|
|
1142
|
-
*
|
|
1143
|
-
*
|
|
1144
|
-
* @returns {Uint8Array} The left endian byte array representation of the plaintext.
|
|
1051
|
+
* Clone.
|
|
1145
1052
|
*/
|
|
1146
|
-
|
|
1053
|
+
clone(): I128;
|
|
1054
|
+
}
|
|
1055
|
+
export class I16 {
|
|
1056
|
+
private constructor();
|
|
1057
|
+
free(): void;
|
|
1147
1058
|
/**
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1150
|
-
* @param {Array} bits A left endian boolean array representing the bits plaintext.
|
|
1151
|
-
*
|
|
1152
|
-
* @returns {Plaintext} The plaintext object.
|
|
1059
|
+
* Creates from string.
|
|
1153
1060
|
*/
|
|
1154
|
-
static
|
|
1061
|
+
static fromString(s: string): I16;
|
|
1155
1062
|
/**
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
* @returns {Array} The left endian boolean array representation of the bits of the plaintext.
|
|
1063
|
+
* To string.
|
|
1159
1064
|
*/
|
|
1160
|
-
|
|
1065
|
+
toString(): string;
|
|
1161
1066
|
/**
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
* @param {Array} fields An array of fields.
|
|
1165
|
-
*
|
|
1166
|
-
* @returns {Plaintext} The plaintext object.
|
|
1067
|
+
* From bytes (LE).
|
|
1167
1068
|
*/
|
|
1168
|
-
static
|
|
1069
|
+
static fromBytesLe(bytes: Uint8Array): I16;
|
|
1169
1070
|
/**
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
* @returns {Array} The field array representation of the plaintext.
|
|
1071
|
+
* To bytes (LE).
|
|
1173
1072
|
*/
|
|
1174
|
-
|
|
1073
|
+
toBytesLe(): Uint8Array;
|
|
1175
1074
|
/**
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
* @returns {string} The string representation of the plaintext.
|
|
1075
|
+
* From bits.
|
|
1179
1076
|
*/
|
|
1180
|
-
|
|
1077
|
+
static fromBitsLe(bits: Array<any>): I16;
|
|
1181
1078
|
/**
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1184
|
-
* @returns {string} The type of the plaintext.
|
|
1079
|
+
* To bits.
|
|
1185
1080
|
*/
|
|
1186
|
-
|
|
1081
|
+
toBitsLe(): Array<any>;
|
|
1187
1082
|
/**
|
|
1188
|
-
*
|
|
1189
|
-
*
|
|
1190
|
-
* @returns {Object} The JS object representation of the plaintext.
|
|
1083
|
+
* Checked absolute value.
|
|
1191
1084
|
*/
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
export class Poseidon2 {
|
|
1195
|
-
free(): void;
|
|
1085
|
+
absChecked(): I16;
|
|
1196
1086
|
/**
|
|
1197
|
-
*
|
|
1087
|
+
* Wrapped absolute value.
|
|
1198
1088
|
*/
|
|
1199
|
-
|
|
1089
|
+
absWrapped(): I16;
|
|
1200
1090
|
/**
|
|
1201
|
-
*
|
|
1091
|
+
* Wrapped addition.
|
|
1202
1092
|
*/
|
|
1203
|
-
|
|
1093
|
+
addWrapped(other: I16): I16;
|
|
1204
1094
|
/**
|
|
1205
|
-
*
|
|
1095
|
+
* Wrapped subtraction.
|
|
1206
1096
|
*/
|
|
1207
|
-
|
|
1097
|
+
subWrapped(other: I16): I16;
|
|
1208
1098
|
/**
|
|
1209
|
-
*
|
|
1099
|
+
* Wrapped multiplication.
|
|
1210
1100
|
*/
|
|
1211
|
-
|
|
1101
|
+
mulWrapped(other: I16): I16;
|
|
1212
1102
|
/**
|
|
1213
|
-
*
|
|
1103
|
+
* Wrapped division.
|
|
1214
1104
|
*/
|
|
1215
|
-
|
|
1105
|
+
divWrapped(other: I16): I16;
|
|
1216
1106
|
/**
|
|
1217
|
-
*
|
|
1107
|
+
* Power to a u8 exponent.
|
|
1218
1108
|
*/
|
|
1219
|
-
|
|
1220
|
-
}
|
|
1221
|
-
export class Poseidon4 {
|
|
1222
|
-
free(): void;
|
|
1109
|
+
powU8(exponent: U8): I16;
|
|
1223
1110
|
/**
|
|
1224
|
-
*
|
|
1111
|
+
* Power to a u16 exponent.
|
|
1225
1112
|
*/
|
|
1226
|
-
|
|
1113
|
+
powU16(exponent: U16): I16;
|
|
1227
1114
|
/**
|
|
1228
|
-
*
|
|
1115
|
+
* Power to a u32 exponent.
|
|
1229
1116
|
*/
|
|
1230
|
-
|
|
1117
|
+
powU32(exponent: U32): I16;
|
|
1231
1118
|
/**
|
|
1232
|
-
*
|
|
1119
|
+
* Negates the integer (e.g., 5 → -5).
|
|
1233
1120
|
*/
|
|
1234
|
-
|
|
1121
|
+
neg(): I16;
|
|
1235
1122
|
/**
|
|
1236
|
-
*
|
|
1123
|
+
* Checks equality with another integer.
|
|
1237
1124
|
*/
|
|
1238
|
-
|
|
1125
|
+
equals(other: I16): boolean;
|
|
1239
1126
|
/**
|
|
1240
|
-
*
|
|
1127
|
+
* Remainder.
|
|
1241
1128
|
*/
|
|
1242
|
-
|
|
1129
|
+
rem(other: I16): I16;
|
|
1243
1130
|
/**
|
|
1244
|
-
*
|
|
1131
|
+
* Wrapped remainder.
|
|
1245
1132
|
*/
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
export class Poseidon8 {
|
|
1249
|
-
free(): void;
|
|
1133
|
+
remWrapped(other: I16): I16;
|
|
1250
1134
|
/**
|
|
1251
|
-
*
|
|
1135
|
+
* Convert to Scalar.
|
|
1252
1136
|
*/
|
|
1253
|
-
|
|
1137
|
+
toScalar(): Scalar;
|
|
1254
1138
|
/**
|
|
1255
|
-
*
|
|
1139
|
+
* Convert to plaintext.
|
|
1256
1140
|
*/
|
|
1257
|
-
|
|
1141
|
+
toPlaintext(): Plaintext;
|
|
1258
1142
|
/**
|
|
1259
|
-
*
|
|
1143
|
+
* Convert from Field.
|
|
1260
1144
|
*/
|
|
1261
|
-
|
|
1145
|
+
static fromField(field: Field): I16;
|
|
1262
1146
|
/**
|
|
1263
|
-
*
|
|
1147
|
+
* Convert from Fields.
|
|
1264
1148
|
*/
|
|
1265
|
-
|
|
1149
|
+
static fromFields(fields: Array<any>): I16;
|
|
1266
1150
|
/**
|
|
1267
|
-
*
|
|
1151
|
+
* Clone.
|
|
1268
1152
|
*/
|
|
1269
|
-
|
|
1270
|
-
/**
|
|
1271
|
-
* Returns the Poseidon hash with an input rate of 8 on the affine curve.
|
|
1272
|
-
*/
|
|
1273
|
-
hashToGroup(input: Array<any>): Group;
|
|
1153
|
+
clone(): I16;
|
|
1274
1154
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
*/
|
|
1278
|
-
export class PrivateKey {
|
|
1155
|
+
export class I32 {
|
|
1156
|
+
private constructor();
|
|
1279
1157
|
free(): void;
|
|
1280
1158
|
/**
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
* @returns {PrivateKey}
|
|
1159
|
+
* Creates from string.
|
|
1284
1160
|
*/
|
|
1285
|
-
|
|
1161
|
+
static fromString(s: string): I32;
|
|
1286
1162
|
/**
|
|
1287
|
-
*
|
|
1288
|
-
*
|
|
1289
|
-
* @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
|
|
1290
|
-
* @returns {PrivateKey}
|
|
1163
|
+
* To string.
|
|
1291
1164
|
*/
|
|
1292
|
-
|
|
1165
|
+
toString(): string;
|
|
1293
1166
|
/**
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
1296
|
-
* @param {string} seed String representation of a private key
|
|
1297
|
-
* @returns {PrivateKey}
|
|
1167
|
+
* From bytes (LE).
|
|
1298
1168
|
*/
|
|
1299
|
-
static
|
|
1169
|
+
static fromBytesLe(bytes: Uint8Array): I32;
|
|
1300
1170
|
/**
|
|
1301
|
-
*
|
|
1302
|
-
* as it exposes the private key plaintext
|
|
1303
|
-
*
|
|
1304
|
-
* @returns {string} String representation of a private key
|
|
1171
|
+
* To bytes (LE).
|
|
1305
1172
|
*/
|
|
1306
|
-
|
|
1173
|
+
toBytesLe(): Uint8Array;
|
|
1307
1174
|
/**
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
* @returns {ViewKey}
|
|
1175
|
+
* From bits.
|
|
1311
1176
|
*/
|
|
1312
|
-
|
|
1177
|
+
static fromBitsLe(bits: Array<any>): I32;
|
|
1313
1178
|
/**
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
* @returns {Address}
|
|
1179
|
+
* To bits.
|
|
1317
1180
|
*/
|
|
1318
|
-
|
|
1181
|
+
toBitsLe(): Array<any>;
|
|
1319
1182
|
/**
|
|
1320
|
-
*
|
|
1321
|
-
*
|
|
1322
|
-
* @param {Uint8Array} Byte array representing a message signed by the address
|
|
1323
|
-
* @returns {Signature} Signature generated by signing the message with the address
|
|
1183
|
+
* Checked absolute value.
|
|
1324
1184
|
*/
|
|
1325
|
-
|
|
1185
|
+
absChecked(): I32;
|
|
1326
1186
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
* and will be needed to decrypt the private key later, so it should be stored securely
|
|
1329
|
-
*
|
|
1330
|
-
* @param {string} secret Secret used to encrypt the private key
|
|
1331
|
-
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
1187
|
+
* Wrapped absolute value.
|
|
1332
1188
|
*/
|
|
1333
|
-
|
|
1189
|
+
absWrapped(): I32;
|
|
1334
1190
|
/**
|
|
1335
|
-
*
|
|
1336
|
-
* decrypt the private key later, so it should be stored securely
|
|
1337
|
-
*
|
|
1338
|
-
* @param {string} secret Secret used to encrypt the private key
|
|
1339
|
-
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
1191
|
+
* Wrapped addition.
|
|
1340
1192
|
*/
|
|
1341
|
-
|
|
1193
|
+
addWrapped(other: I32): I32;
|
|
1342
1194
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
*
|
|
1345
|
-
* @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
|
|
1346
|
-
* @param {string} secret Secret originally used to encrypt the private key
|
|
1347
|
-
* @returns {PrivateKey} Private key
|
|
1195
|
+
* Wrapped subtraction.
|
|
1348
1196
|
*/
|
|
1349
|
-
|
|
1197
|
+
subWrapped(other: I32): I32;
|
|
1198
|
+
/**
|
|
1199
|
+
* Wrapped multiplication.
|
|
1200
|
+
*/
|
|
1201
|
+
mulWrapped(other: I32): I32;
|
|
1202
|
+
/**
|
|
1203
|
+
* Wrapped division.
|
|
1204
|
+
*/
|
|
1205
|
+
divWrapped(other: I32): I32;
|
|
1206
|
+
/**
|
|
1207
|
+
* Power to a u8 exponent.
|
|
1208
|
+
*/
|
|
1209
|
+
powU8(exponent: U8): I32;
|
|
1210
|
+
/**
|
|
1211
|
+
* Power to a u16 exponent.
|
|
1212
|
+
*/
|
|
1213
|
+
powU16(exponent: U16): I32;
|
|
1214
|
+
/**
|
|
1215
|
+
* Power to a u32 exponent.
|
|
1216
|
+
*/
|
|
1217
|
+
powU32(exponent: U32): I32;
|
|
1218
|
+
/**
|
|
1219
|
+
* Negates the integer (e.g., 5 → -5).
|
|
1220
|
+
*/
|
|
1221
|
+
neg(): I32;
|
|
1222
|
+
/**
|
|
1223
|
+
* Checks equality with another integer.
|
|
1224
|
+
*/
|
|
1225
|
+
equals(other: I32): boolean;
|
|
1226
|
+
/**
|
|
1227
|
+
* Remainder.
|
|
1228
|
+
*/
|
|
1229
|
+
rem(other: I32): I32;
|
|
1230
|
+
/**
|
|
1231
|
+
* Wrapped remainder.
|
|
1232
|
+
*/
|
|
1233
|
+
remWrapped(other: I32): I32;
|
|
1234
|
+
/**
|
|
1235
|
+
* Convert to Scalar.
|
|
1236
|
+
*/
|
|
1237
|
+
toScalar(): Scalar;
|
|
1238
|
+
/**
|
|
1239
|
+
* Convert to plaintext.
|
|
1240
|
+
*/
|
|
1241
|
+
toPlaintext(): Plaintext;
|
|
1242
|
+
/**
|
|
1243
|
+
* Convert from Field.
|
|
1244
|
+
*/
|
|
1245
|
+
static fromField(field: Field): I32;
|
|
1246
|
+
/**
|
|
1247
|
+
* Convert from Fields.
|
|
1248
|
+
*/
|
|
1249
|
+
static fromFields(fields: Array<any>): I32;
|
|
1250
|
+
/**
|
|
1251
|
+
* Clone.
|
|
1252
|
+
*/
|
|
1253
|
+
clone(): I32;
|
|
1350
1254
|
}
|
|
1351
|
-
|
|
1352
|
-
* Private Key in ciphertext form
|
|
1353
|
-
*/
|
|
1354
|
-
export class PrivateKeyCiphertext {
|
|
1255
|
+
export class I64 {
|
|
1355
1256
|
private constructor();
|
|
1356
1257
|
free(): void;
|
|
1357
1258
|
/**
|
|
1358
|
-
*
|
|
1359
|
-
* decrypt the private key later, so it should be stored securely
|
|
1360
|
-
*
|
|
1361
|
-
* @param {PrivateKey} private_key Private key to encrypt
|
|
1362
|
-
* @param {string} secret Secret to encrypt the private key with
|
|
1363
|
-
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
1259
|
+
* Creates from string.
|
|
1364
1260
|
*/
|
|
1365
|
-
static
|
|
1261
|
+
static fromString(s: string): I64;
|
|
1366
1262
|
/**
|
|
1367
|
-
*
|
|
1368
|
-
* encrypt the private key
|
|
1369
|
-
*
|
|
1370
|
-
* @param {string} secret Secret used to encrypt the private key
|
|
1371
|
-
* @returns {PrivateKey} Private key
|
|
1263
|
+
* To string.
|
|
1372
1264
|
*/
|
|
1373
|
-
|
|
1265
|
+
toString(): string;
|
|
1374
1266
|
/**
|
|
1375
|
-
*
|
|
1376
|
-
*
|
|
1377
|
-
* @returns {string} Ciphertext string
|
|
1267
|
+
* From bytes (LE).
|
|
1378
1268
|
*/
|
|
1379
|
-
|
|
1269
|
+
static fromBytesLe(bytes: Uint8Array): I64;
|
|
1380
1270
|
/**
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
* @param {string} ciphertext Ciphertext string
|
|
1384
|
-
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
1271
|
+
* To bytes (LE).
|
|
1385
1272
|
*/
|
|
1386
|
-
|
|
1273
|
+
toBytesLe(): Uint8Array;
|
|
1274
|
+
/**
|
|
1275
|
+
* From bits.
|
|
1276
|
+
*/
|
|
1277
|
+
static fromBitsLe(bits: Array<any>): I64;
|
|
1278
|
+
/**
|
|
1279
|
+
* To bits.
|
|
1280
|
+
*/
|
|
1281
|
+
toBitsLe(): Array<any>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Checked absolute value.
|
|
1284
|
+
*/
|
|
1285
|
+
absChecked(): I64;
|
|
1286
|
+
/**
|
|
1287
|
+
* Wrapped absolute value.
|
|
1288
|
+
*/
|
|
1289
|
+
absWrapped(): I64;
|
|
1290
|
+
/**
|
|
1291
|
+
* Wrapped addition.
|
|
1292
|
+
*/
|
|
1293
|
+
addWrapped(other: I64): I64;
|
|
1294
|
+
/**
|
|
1295
|
+
* Wrapped subtraction.
|
|
1296
|
+
*/
|
|
1297
|
+
subWrapped(other: I64): I64;
|
|
1298
|
+
/**
|
|
1299
|
+
* Wrapped multiplication.
|
|
1300
|
+
*/
|
|
1301
|
+
mulWrapped(other: I64): I64;
|
|
1302
|
+
/**
|
|
1303
|
+
* Wrapped division.
|
|
1304
|
+
*/
|
|
1305
|
+
divWrapped(other: I64): I64;
|
|
1306
|
+
/**
|
|
1307
|
+
* Power to a u8 exponent.
|
|
1308
|
+
*/
|
|
1309
|
+
powU8(exponent: U8): I64;
|
|
1310
|
+
/**
|
|
1311
|
+
* Power to a u16 exponent.
|
|
1312
|
+
*/
|
|
1313
|
+
powU16(exponent: U16): I64;
|
|
1314
|
+
/**
|
|
1315
|
+
* Power to a u32 exponent.
|
|
1316
|
+
*/
|
|
1317
|
+
powU32(exponent: U32): I64;
|
|
1318
|
+
/**
|
|
1319
|
+
* Negates the integer (e.g., 5 → -5).
|
|
1320
|
+
*/
|
|
1321
|
+
neg(): I64;
|
|
1322
|
+
/**
|
|
1323
|
+
* Checks equality with another integer.
|
|
1324
|
+
*/
|
|
1325
|
+
equals(other: I64): boolean;
|
|
1326
|
+
/**
|
|
1327
|
+
* Remainder.
|
|
1328
|
+
*/
|
|
1329
|
+
rem(other: I64): I64;
|
|
1330
|
+
/**
|
|
1331
|
+
* Wrapped remainder.
|
|
1332
|
+
*/
|
|
1333
|
+
remWrapped(other: I64): I64;
|
|
1334
|
+
/**
|
|
1335
|
+
* Convert to Scalar.
|
|
1336
|
+
*/
|
|
1337
|
+
toScalar(): Scalar;
|
|
1338
|
+
/**
|
|
1339
|
+
* Convert to plaintext.
|
|
1340
|
+
*/
|
|
1341
|
+
toPlaintext(): Plaintext;
|
|
1342
|
+
/**
|
|
1343
|
+
* Convert from Field.
|
|
1344
|
+
*/
|
|
1345
|
+
static fromField(field: Field): I64;
|
|
1346
|
+
/**
|
|
1347
|
+
* Convert from Fields.
|
|
1348
|
+
*/
|
|
1349
|
+
static fromFields(fields: Array<any>): I64;
|
|
1350
|
+
/**
|
|
1351
|
+
* Clone.
|
|
1352
|
+
*/
|
|
1353
|
+
clone(): I64;
|
|
1387
1354
|
}
|
|
1388
|
-
|
|
1389
|
-
* Webassembly Representation of an Aleo program
|
|
1390
|
-
*/
|
|
1391
|
-
export class Program {
|
|
1355
|
+
export class I8 {
|
|
1392
1356
|
private constructor();
|
|
1393
1357
|
free(): void;
|
|
1394
1358
|
/**
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1397
|
-
* @param {string} program Aleo program source code
|
|
1398
|
-
* @returns {Program} Program object
|
|
1359
|
+
* Creates from string.
|
|
1399
1360
|
*/
|
|
1400
|
-
static fromString(
|
|
1361
|
+
static fromString(s: string): I8;
|
|
1401
1362
|
/**
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
* @returns {string} String containing the program source code
|
|
1363
|
+
* To string.
|
|
1405
1364
|
*/
|
|
1406
1365
|
toString(): string;
|
|
1407
1366
|
/**
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1410
|
-
* @param {string} functionName Name of the function to check for
|
|
1411
|
-
* @returns {boolean} True if the program is valid, false otherwise
|
|
1367
|
+
* From bytes (LE).
|
|
1412
1368
|
*/
|
|
1413
|
-
|
|
1369
|
+
static fromBytesLe(bytes: Uint8Array): I8;
|
|
1414
1370
|
/**
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1417
|
-
* @returns {Array} Array of all function names present in the program
|
|
1418
|
-
*
|
|
1419
|
-
* @example
|
|
1420
|
-
* const expected_functions = [
|
|
1421
|
-
* "mint",
|
|
1422
|
-
* "transfer_private",
|
|
1423
|
-
* "transfer_private_to_public",
|
|
1424
|
-
* "transfer_public",
|
|
1425
|
-
* "transfer_public_to_private",
|
|
1426
|
-
* "join",
|
|
1427
|
-
* "split",
|
|
1428
|
-
* "fee"
|
|
1429
|
-
* ]
|
|
1430
|
-
*
|
|
1431
|
-
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
1432
|
-
* const credits_functions = credits_program.getFunctions();
|
|
1433
|
-
* console.log(credits_functions === expected_functions); // Output should be "true"
|
|
1371
|
+
* To bytes (LE).
|
|
1434
1372
|
*/
|
|
1435
|
-
|
|
1373
|
+
toBytesLe(): Uint8Array;
|
|
1436
1374
|
/**
|
|
1437
|
-
*
|
|
1438
|
-
* to generate a web form to capture user inputs for an execution of a function.
|
|
1439
|
-
*
|
|
1440
|
-
* @param {string} function_name Name of the function to get inputs for
|
|
1441
|
-
* @returns {Array} Array of function inputs
|
|
1442
|
-
*
|
|
1443
|
-
* @example
|
|
1444
|
-
* const expected_inputs = [
|
|
1445
|
-
* {
|
|
1446
|
-
* type:"record",
|
|
1447
|
-
* visibility:"private",
|
|
1448
|
-
* record:"credits",
|
|
1449
|
-
* members:[
|
|
1450
|
-
* {
|
|
1451
|
-
* name:"microcredits",
|
|
1452
|
-
* type:"u64",
|
|
1453
|
-
* visibility:"private"
|
|
1454
|
-
* }
|
|
1455
|
-
* ],
|
|
1456
|
-
* register:"r0"
|
|
1457
|
-
* },
|
|
1458
|
-
* {
|
|
1459
|
-
* type:"address",
|
|
1460
|
-
* visibility:"private",
|
|
1461
|
-
* register:"r1"
|
|
1462
|
-
* },
|
|
1463
|
-
* {
|
|
1464
|
-
* type:"u64",
|
|
1465
|
-
* visibility:"private",
|
|
1466
|
-
* register:"r2"
|
|
1467
|
-
* }
|
|
1468
|
-
* ];
|
|
1469
|
-
*
|
|
1470
|
-
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
1471
|
-
* const transfer_function_inputs = credits_program.getFunctionInputs("transfer_private");
|
|
1472
|
-
* console.log(transfer_function_inputs === expected_inputs); // Output should be "true"
|
|
1375
|
+
* From bits.
|
|
1473
1376
|
*/
|
|
1474
|
-
|
|
1377
|
+
static fromBitsLe(bits: Array<any>): I8;
|
|
1475
1378
|
/**
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
* @returns {Array} - An array of objects representing the mappings in the program
|
|
1479
|
-
* @example
|
|
1480
|
-
* const expected_mappings = [
|
|
1481
|
-
* {
|
|
1482
|
-
* name: "account",
|
|
1483
|
-
* key_name: "owner",
|
|
1484
|
-
* key_type: "address",
|
|
1485
|
-
* value_name: "microcredits",
|
|
1486
|
-
* value_type: "u64"
|
|
1487
|
-
* }
|
|
1488
|
-
* ]
|
|
1489
|
-
*
|
|
1490
|
-
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
1491
|
-
* const credits_mappings = credits_program.getMappings();
|
|
1492
|
-
* console.log(credits_mappings === expected_mappings); // Output should be "true"
|
|
1379
|
+
* To bits.
|
|
1493
1380
|
*/
|
|
1494
|
-
|
|
1381
|
+
toBitsLe(): Array<any>;
|
|
1495
1382
|
/**
|
|
1496
|
-
*
|
|
1383
|
+
* Checked absolute value.
|
|
1384
|
+
*/
|
|
1385
|
+
absChecked(): I8;
|
|
1386
|
+
/**
|
|
1387
|
+
* Wrapped absolute value.
|
|
1388
|
+
*/
|
|
1389
|
+
absWrapped(): I8;
|
|
1390
|
+
/**
|
|
1391
|
+
* Wrapped addition.
|
|
1392
|
+
*/
|
|
1393
|
+
addWrapped(other: I8): I8;
|
|
1394
|
+
/**
|
|
1395
|
+
* Wrapped subtraction.
|
|
1396
|
+
*/
|
|
1397
|
+
subWrapped(other: I8): I8;
|
|
1398
|
+
/**
|
|
1399
|
+
* Wrapped multiplication.
|
|
1400
|
+
*/
|
|
1401
|
+
mulWrapped(other: I8): I8;
|
|
1402
|
+
/**
|
|
1403
|
+
* Wrapped division.
|
|
1404
|
+
*/
|
|
1405
|
+
divWrapped(other: I8): I8;
|
|
1406
|
+
/**
|
|
1407
|
+
* Power to a u8 exponent.
|
|
1408
|
+
*/
|
|
1409
|
+
powU8(exponent: U8): I8;
|
|
1410
|
+
/**
|
|
1411
|
+
* Power to a u16 exponent.
|
|
1412
|
+
*/
|
|
1413
|
+
powU16(exponent: U16): I8;
|
|
1414
|
+
/**
|
|
1415
|
+
* Power to a u32 exponent.
|
|
1416
|
+
*/
|
|
1417
|
+
powU32(exponent: U32): I8;
|
|
1418
|
+
/**
|
|
1419
|
+
* Negates the integer (e.g., 5 → -5).
|
|
1420
|
+
*/
|
|
1421
|
+
neg(): I8;
|
|
1422
|
+
/**
|
|
1423
|
+
* Checks equality with another integer.
|
|
1424
|
+
*/
|
|
1425
|
+
equals(other: I8): boolean;
|
|
1426
|
+
/**
|
|
1427
|
+
* Remainder.
|
|
1428
|
+
*/
|
|
1429
|
+
rem(other: I8): I8;
|
|
1430
|
+
/**
|
|
1431
|
+
* Wrapped remainder.
|
|
1432
|
+
*/
|
|
1433
|
+
remWrapped(other: I8): I8;
|
|
1434
|
+
/**
|
|
1435
|
+
* Convert to Scalar.
|
|
1436
|
+
*/
|
|
1437
|
+
toScalar(): Scalar;
|
|
1438
|
+
/**
|
|
1439
|
+
* Convert to plaintext.
|
|
1440
|
+
*/
|
|
1441
|
+
toPlaintext(): Plaintext;
|
|
1442
|
+
/**
|
|
1443
|
+
* Convert from Field.
|
|
1444
|
+
*/
|
|
1445
|
+
static fromField(field: Field): I8;
|
|
1446
|
+
/**
|
|
1447
|
+
* Convert from Fields.
|
|
1448
|
+
*/
|
|
1449
|
+
static fromFields(fields: Array<any>): I8;
|
|
1450
|
+
/**
|
|
1451
|
+
* Clone.
|
|
1452
|
+
*/
|
|
1453
|
+
clone(): I8;
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Key pair object containing both the function proving and verifying keys
|
|
1457
|
+
*/
|
|
1458
|
+
export class KeyPair {
|
|
1459
|
+
free(): void;
|
|
1460
|
+
/**
|
|
1461
|
+
* Create new key pair from proving and verifying keys
|
|
1462
|
+
*
|
|
1463
|
+
* @param {ProvingKey} proving_key Proving key corresponding to a function in an Aleo program
|
|
1464
|
+
* @param {VerifyingKey} verifying_key Verifying key corresponding to a function in an Aleo program
|
|
1465
|
+
* @returns {KeyPair} Key pair object containing both the function proving and verifying keys
|
|
1466
|
+
*/
|
|
1467
|
+
constructor(proving_key: ProvingKey, verifying_key: VerifyingKey);
|
|
1468
|
+
/**
|
|
1469
|
+
* Get the proving key. This method will remove the proving key from the key pair
|
|
1470
|
+
*
|
|
1471
|
+
* @returns {ProvingKey}
|
|
1472
|
+
*/
|
|
1473
|
+
provingKey(): ProvingKey;
|
|
1474
|
+
/**
|
|
1475
|
+
* Get the verifying key. This method will remove the verifying key from the key pair
|
|
1476
|
+
*
|
|
1477
|
+
* @returns {VerifyingKey}
|
|
1478
|
+
*/
|
|
1479
|
+
verifyingKey(): VerifyingKey;
|
|
1480
|
+
}
|
|
1481
|
+
export class Metadata {
|
|
1482
|
+
private constructor();
|
|
1483
|
+
free(): void;
|
|
1484
|
+
static baseUrl(): string;
|
|
1485
|
+
static bond_public(): Metadata;
|
|
1486
|
+
static bond_validator(): Metadata;
|
|
1487
|
+
static claim_unbond_public(): Metadata;
|
|
1488
|
+
static fee_private(): Metadata;
|
|
1489
|
+
static fee_public(): Metadata;
|
|
1490
|
+
static inclusion(): Metadata;
|
|
1491
|
+
static join(): Metadata;
|
|
1492
|
+
static set_validator_state(): Metadata;
|
|
1493
|
+
static split(): Metadata;
|
|
1494
|
+
static transfer_private(): Metadata;
|
|
1495
|
+
static transfer_private_to_public(): Metadata;
|
|
1496
|
+
static transfer_public(): Metadata;
|
|
1497
|
+
static transfer_public_as_signer(): Metadata;
|
|
1498
|
+
static transfer_public_to_private(): Metadata;
|
|
1499
|
+
static unbond_public(): Metadata;
|
|
1500
|
+
name: string;
|
|
1501
|
+
locator: string;
|
|
1502
|
+
prover: string;
|
|
1503
|
+
verifier: string;
|
|
1504
|
+
verifyingKey: string;
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* An offline query object used to insert the global state root and state paths needed to create
|
|
1508
|
+
* a valid inclusion proof offline.
|
|
1509
|
+
*/
|
|
1510
|
+
export class OfflineQuery {
|
|
1511
|
+
free(): void;
|
|
1512
|
+
/**
|
|
1513
|
+
* Creates a new offline query object. The state root is required to be passed in as a string
|
|
1514
|
+
*
|
|
1515
|
+
* @param {u32} block_height The block height.
|
|
1516
|
+
* @param {string} state_root The state root of the current network.
|
|
1517
|
+
*
|
|
1518
|
+
* @returns {OfflineQuery} The newly created offline query object.
|
|
1519
|
+
*/
|
|
1520
|
+
constructor(block_height: number, state_root: string);
|
|
1521
|
+
/**
|
|
1522
|
+
* Add a new block height to the offline query object.
|
|
1523
|
+
*
|
|
1524
|
+
* @param {u32} block_height The block height to add.
|
|
1525
|
+
*/
|
|
1526
|
+
addBlockHeight(block_height: number): void;
|
|
1527
|
+
/**
|
|
1528
|
+
* Add a new state path to the offline query object.
|
|
1529
|
+
*
|
|
1530
|
+
* @param {string} commitment: The commitment corresponding to a record input.
|
|
1531
|
+
* @param {string} state_path: The state path corresponding to the commitment.
|
|
1532
|
+
*/
|
|
1533
|
+
addStatePath(commitment: string, state_path: string): void;
|
|
1534
|
+
/**
|
|
1535
|
+
* Get a json string representation of the offline query object.
|
|
1536
|
+
*
|
|
1537
|
+
* @returns {string} JSON string representation of the offline query object.
|
|
1538
|
+
*/
|
|
1539
|
+
toString(): string;
|
|
1540
|
+
/**
|
|
1541
|
+
* Create an offline query object from a json string representation.
|
|
1542
|
+
*
|
|
1543
|
+
* @param {string} JSON string representation of the offline query object.
|
|
1544
|
+
*/
|
|
1545
|
+
static fromString(s: string): OfflineQuery;
|
|
1546
|
+
}
|
|
1547
|
+
export class Pedersen128 {
|
|
1548
|
+
free(): void;
|
|
1549
|
+
/**
|
|
1550
|
+
* Create a Pedersen hasher for a given (up to) 128-bit input.
|
|
1551
|
+
*/
|
|
1552
|
+
constructor();
|
|
1553
|
+
/**
|
|
1554
|
+
* Create a Pedersen hasher for a given (up to) 128-bit input with a custom domain separator.
|
|
1555
|
+
*/
|
|
1556
|
+
static setup(domain_separator: string): Pedersen128;
|
|
1557
|
+
/**
|
|
1558
|
+
* Returns the Pedersen hash for a given (up to) 128-bit input.
|
|
1559
|
+
*/
|
|
1560
|
+
hash(input: Array<any>): Field;
|
|
1561
|
+
/**
|
|
1562
|
+
* Returns a Pedersen commitment for the given (up to) 128-bit input and randomizer.
|
|
1563
|
+
*/
|
|
1564
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
1565
|
+
/**
|
|
1566
|
+
* Returns a Pedersen commitment for the given (up to) 128-bit input and randomizer.
|
|
1567
|
+
*/
|
|
1568
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
1569
|
+
}
|
|
1570
|
+
export class Pedersen64 {
|
|
1571
|
+
free(): void;
|
|
1572
|
+
/**
|
|
1573
|
+
* Create a Pedersen hasher for a given (up to) 64-bit input.
|
|
1574
|
+
*/
|
|
1575
|
+
constructor();
|
|
1576
|
+
/**
|
|
1577
|
+
* Create a Pedersen64 hasher for a given (up to) 64-bit input with a custom domain separator.
|
|
1578
|
+
*/
|
|
1579
|
+
static setup(domain_separator: string): Pedersen64;
|
|
1580
|
+
/**
|
|
1581
|
+
* Returns the Pedersen hash for a given (up to) 64-bit input.
|
|
1582
|
+
*/
|
|
1583
|
+
hash(input: Array<any>): Field;
|
|
1584
|
+
/**
|
|
1585
|
+
* Returns a Pedersen commitment for the given (up to) 64-bit input and randomizer.
|
|
1586
|
+
*/
|
|
1587
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
1588
|
+
/**
|
|
1589
|
+
* Returns a Pedersen commitment for the given (up to) 64-bit input and randomizer.
|
|
1590
|
+
*/
|
|
1591
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* SnarkVM Plaintext object. Plaintext is a fundamental monadic type used to represent Aleo
|
|
1595
|
+
* primitive types (boolean, field, group, i8, i16, i32, i64, i128, u8, u16, u32, u64, u128,
|
|
1596
|
+
* scalar, and signature), struct types, and array types.
|
|
1597
|
+
*
|
|
1598
|
+
* In the context of a web or NodeJS application, this type is useful for turning an Aleo type into
|
|
1599
|
+
* a JS value, object, or array that might be necessary for performing computations within the
|
|
1600
|
+
* application.
|
|
1601
|
+
*
|
|
1602
|
+
* @example
|
|
1603
|
+
* // Get the bond state of an existing address.
|
|
1604
|
+
* const bondState = await fetch(https://api.explorer.provable.com/v1/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
1605
|
+
* // Convert the bond state to a Plaintext object.
|
|
1606
|
+
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
1607
|
+
* // Convert the Plaintext object to a JS object.
|
|
1608
|
+
* const bondStateObject = bond_state_plaintext.toObject();
|
|
1609
|
+
* // Check if the bond state matches the expected object.
|
|
1610
|
+
* const expectedObject = { validator: "aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f", microcredits: 100000000u64 };
|
|
1611
|
+
* assert( JSON.stringify(bondStateObject) === JSON.stringify(expectedObject) );
|
|
1612
|
+
*/
|
|
1613
|
+
export class Plaintext {
|
|
1614
|
+
private constructor();
|
|
1615
|
+
free(): void;
|
|
1616
|
+
/**
|
|
1617
|
+
* Find plaintext member if the plaintext is a struct. Returns `null` if the plaintext is not
|
|
1618
|
+
* a struct or the member does not exist.
|
|
1619
|
+
*
|
|
1620
|
+
* @param {string} name The name of the plaintext member to find.
|
|
1621
|
+
*
|
|
1622
|
+
* @returns {Plaintext} The plaintext member.
|
|
1623
|
+
*/
|
|
1624
|
+
find(name: string): Plaintext;
|
|
1625
|
+
/**
|
|
1626
|
+
* Encrypt a plaintext with an address and randomizer.
|
|
1627
|
+
*
|
|
1628
|
+
* @param {Address} address The address to encrypt the plaintext for.
|
|
1629
|
+
* @param {Scalar} randomizer The randomizer to use for encryption.
|
|
1630
|
+
*
|
|
1631
|
+
* @returns {Ciphertext} The encrypted ciphertext.
|
|
1632
|
+
*/
|
|
1633
|
+
encrypt(address: Address, randomizer: Scalar): Ciphertext;
|
|
1634
|
+
/**
|
|
1635
|
+
* Encrypt a plaintext with a transition view key.
|
|
1636
|
+
*
|
|
1637
|
+
* @param {Field} transition_view_key The transition view key of the transition
|
|
1638
|
+
* associated with the plaintext.
|
|
1639
|
+
*
|
|
1640
|
+
* @returns {Ciphertext} The encrypted ciphertext.
|
|
1641
|
+
*/
|
|
1642
|
+
encryptSymmetric(transition_view_key: Field): Ciphertext;
|
|
1643
|
+
/**
|
|
1644
|
+
* Creates a plaintext object from a string representation of a plaintext.
|
|
1645
|
+
*
|
|
1646
|
+
* @param {string} plaintext The string representation of the plaintext.
|
|
1647
|
+
*
|
|
1648
|
+
* @returns {Plaintext} The plaintext object.
|
|
1649
|
+
*/
|
|
1650
|
+
static fromString(plaintext: string): Plaintext;
|
|
1651
|
+
/**
|
|
1652
|
+
* Get a plaintext object from a series of bytes.
|
|
1653
|
+
*
|
|
1654
|
+
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
1655
|
+
*
|
|
1656
|
+
* @returns {Plaintext} The plaintext object.
|
|
1657
|
+
*/
|
|
1658
|
+
static fromBytesLe(bytes: Uint8Array): Plaintext;
|
|
1659
|
+
/**
|
|
1660
|
+
* Get the left endian byte array representation of the plaintext.
|
|
1661
|
+
*
|
|
1662
|
+
* @returns {Uint8Array} The left endian byte array representation of the plaintext.
|
|
1663
|
+
*/
|
|
1664
|
+
toBytesLe(): Uint8Array;
|
|
1665
|
+
/**
|
|
1666
|
+
* Get a plaintext object from a series of bits represented as a boolean array.
|
|
1667
|
+
*
|
|
1668
|
+
* @param {Array} bits A left endian boolean array representing the bits plaintext.
|
|
1669
|
+
*
|
|
1670
|
+
* @returns {Plaintext} The plaintext object.
|
|
1671
|
+
*/
|
|
1672
|
+
static fromBitsLe(bits: Array<any>): Plaintext;
|
|
1673
|
+
/**
|
|
1674
|
+
* Get the left endian boolean array representation of the bits of the plaintext.
|
|
1675
|
+
*
|
|
1676
|
+
* @returns {Array} The left endian boolean array representation of the bits of the plaintext.
|
|
1677
|
+
*/
|
|
1678
|
+
toBitsLe(): Array<any>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Get a plaintext object from an array of fields.
|
|
1681
|
+
*
|
|
1682
|
+
* @param {Array} fields An array of fields.
|
|
1683
|
+
*
|
|
1684
|
+
* @returns {Plaintext} The plaintext object.
|
|
1685
|
+
*/
|
|
1686
|
+
static fromFields(fields: Array<any>): Plaintext;
|
|
1687
|
+
/**
|
|
1688
|
+
* Get the field array representation of the plaintext.
|
|
1689
|
+
*
|
|
1690
|
+
* @returns {Array} The field array representation of the plaintext.
|
|
1691
|
+
*/
|
|
1692
|
+
toFields(): Array<any>;
|
|
1693
|
+
/**
|
|
1694
|
+
* Returns the string representation of the plaintext.
|
|
1695
|
+
*
|
|
1696
|
+
* @returns {string} The string representation of the plaintext.
|
|
1697
|
+
*/
|
|
1698
|
+
toString(): string;
|
|
1699
|
+
/**
|
|
1700
|
+
* Gives the type of the plaintext.
|
|
1701
|
+
*
|
|
1702
|
+
* @returns {string} The type of the plaintext.
|
|
1703
|
+
*/
|
|
1704
|
+
plaintextType(): string;
|
|
1705
|
+
/**
|
|
1706
|
+
* Attempt to convert the plaintext to a JS object.
|
|
1707
|
+
*
|
|
1708
|
+
* @returns {Object} The JS object representation of the plaintext.
|
|
1709
|
+
*/
|
|
1710
|
+
toObject(): any;
|
|
1711
|
+
}
|
|
1712
|
+
export class Poseidon2 {
|
|
1713
|
+
free(): void;
|
|
1714
|
+
/**
|
|
1715
|
+
* Create a Poseidon hasher with an input rate of 2.
|
|
1716
|
+
*/
|
|
1717
|
+
constructor();
|
|
1718
|
+
/**
|
|
1719
|
+
* Create a Poseidon hasher with an input rate of 2 and a custom domain separator.
|
|
1720
|
+
*/
|
|
1721
|
+
static setup(domain_separator: string): Poseidon2;
|
|
1722
|
+
/**
|
|
1723
|
+
* Returns the Poseidon hash with an input rate of 2.
|
|
1724
|
+
*/
|
|
1725
|
+
hash(input: Array<any>): Field;
|
|
1726
|
+
/**
|
|
1727
|
+
* Returns the extended Poseidon hash with an input rate of 2.
|
|
1728
|
+
*/
|
|
1729
|
+
hashMany(input: Array<any>, num_outputs: number): Array<any>;
|
|
1730
|
+
/**
|
|
1731
|
+
* Returns the Poseidon hash with an input rate of 2 on the scalar field.
|
|
1732
|
+
*/
|
|
1733
|
+
hashToScalar(input: Array<any>): Scalar;
|
|
1734
|
+
/**
|
|
1735
|
+
* Returns the Poseidon hash with an input rate of 2 on the affine curve.
|
|
1736
|
+
*/
|
|
1737
|
+
hashToGroup(input: Array<any>): Group;
|
|
1738
|
+
}
|
|
1739
|
+
export class Poseidon4 {
|
|
1740
|
+
free(): void;
|
|
1741
|
+
/**
|
|
1742
|
+
* Create a Poseidon hasher with an input rate of 4.
|
|
1743
|
+
*/
|
|
1744
|
+
constructor();
|
|
1745
|
+
/**
|
|
1746
|
+
* Create a Poseidon hasher with an input rate of 4 and a custom domain separator.
|
|
1747
|
+
*/
|
|
1748
|
+
static setup(domain_separator: string): Poseidon4;
|
|
1749
|
+
/**
|
|
1750
|
+
* Returns the Poseidon hash with an input rate of 4.
|
|
1751
|
+
*/
|
|
1752
|
+
hash(input: Array<any>): Field;
|
|
1753
|
+
/**
|
|
1754
|
+
* Returns the extended Poseidon hash with an input rate of 4.
|
|
1755
|
+
*/
|
|
1756
|
+
hashMany(input: Array<any>, num_outputs: number): Array<any>;
|
|
1757
|
+
/**
|
|
1758
|
+
* Returns the Poseidon hash with an input rate of 4 on the scalar field.
|
|
1759
|
+
*/
|
|
1760
|
+
hashToScalar(input: Array<any>): Scalar;
|
|
1761
|
+
/**
|
|
1762
|
+
* Returns the Poseidon hash with an input rate of 4 on the affine curve.
|
|
1763
|
+
*/
|
|
1764
|
+
hashToGroup(input: Array<any>): Group;
|
|
1765
|
+
}
|
|
1766
|
+
export class Poseidon8 {
|
|
1767
|
+
free(): void;
|
|
1768
|
+
/**
|
|
1769
|
+
* Create a Poseidon hasher with an input rate of 8.
|
|
1770
|
+
*/
|
|
1771
|
+
constructor();
|
|
1772
|
+
/**
|
|
1773
|
+
* Create a Poseidon hasher with an input rate of 8 and a custom domain separator.
|
|
1774
|
+
*/
|
|
1775
|
+
static setup(domain_separator: string): Poseidon8;
|
|
1776
|
+
/**
|
|
1777
|
+
* Returns the Poseidon hash with an input rate of 8.
|
|
1778
|
+
*/
|
|
1779
|
+
hash(input: Array<any>): Field;
|
|
1780
|
+
/**
|
|
1781
|
+
* Returns the extended Poseidon hash with an input rate of 8.
|
|
1782
|
+
*/
|
|
1783
|
+
hashMany(input: Array<any>, num_outputs: number): Array<any>;
|
|
1784
|
+
/**
|
|
1785
|
+
* Returns the Poseidon hash with an input rate of 8 on the scalar field.
|
|
1786
|
+
*/
|
|
1787
|
+
hashToScalar(input: Array<any>): Scalar;
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns the Poseidon hash with an input rate of 8 on the affine curve.
|
|
1790
|
+
*/
|
|
1791
|
+
hashToGroup(input: Array<any>): Group;
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Private key of an Aleo account
|
|
1795
|
+
*/
|
|
1796
|
+
export class PrivateKey {
|
|
1797
|
+
free(): void;
|
|
1798
|
+
/**
|
|
1799
|
+
* Generate a new private key using a cryptographically secure random number generator
|
|
1800
|
+
*
|
|
1801
|
+
* @returns {PrivateKey}
|
|
1802
|
+
*/
|
|
1803
|
+
constructor();
|
|
1804
|
+
/**
|
|
1805
|
+
* Get a private key from a series of unchecked bytes
|
|
1806
|
+
*
|
|
1807
|
+
* @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
|
|
1808
|
+
* @returns {PrivateKey}
|
|
1809
|
+
*/
|
|
1810
|
+
static from_seed_unchecked(seed: Uint8Array): PrivateKey;
|
|
1811
|
+
/**
|
|
1812
|
+
* Get a private key from a string representation of a private key
|
|
1813
|
+
*
|
|
1814
|
+
* @param {string} seed String representation of a private key
|
|
1815
|
+
* @returns {PrivateKey}
|
|
1816
|
+
*/
|
|
1817
|
+
static from_string(private_key: string): PrivateKey;
|
|
1818
|
+
/**
|
|
1819
|
+
* Get a string representation of the private key. This function should be used very carefully
|
|
1820
|
+
* as it exposes the private key plaintext
|
|
1821
|
+
*
|
|
1822
|
+
* @returns {string} String representation of a private key
|
|
1823
|
+
*/
|
|
1824
|
+
to_string(): string;
|
|
1825
|
+
/**
|
|
1826
|
+
* Get the view key corresponding to the private key
|
|
1827
|
+
*
|
|
1828
|
+
* @returns {ViewKey}
|
|
1829
|
+
*/
|
|
1830
|
+
to_view_key(): ViewKey;
|
|
1831
|
+
/**
|
|
1832
|
+
* Get the address corresponding to the private key
|
|
1833
|
+
*
|
|
1834
|
+
* @returns {Address}
|
|
1835
|
+
*/
|
|
1836
|
+
to_address(): Address;
|
|
1837
|
+
/**
|
|
1838
|
+
* Sign a message with the private key
|
|
1839
|
+
*
|
|
1840
|
+
* @param {Uint8Array} Byte array representing a message signed by the address
|
|
1841
|
+
* @returns {Signature} Signature generated by signing the message with the address
|
|
1842
|
+
*/
|
|
1843
|
+
sign(message: Uint8Array): Signature;
|
|
1844
|
+
/**
|
|
1845
|
+
* Get a new randomly generated private key ciphertext using a secret. The secret is sensitive
|
|
1846
|
+
* and will be needed to decrypt the private key later, so it should be stored securely
|
|
1847
|
+
*
|
|
1848
|
+
* @param {string} secret Secret used to encrypt the private key
|
|
1849
|
+
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
1850
|
+
*/
|
|
1851
|
+
static newEncrypted(secret: string): PrivateKeyCiphertext;
|
|
1852
|
+
/**
|
|
1853
|
+
* Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
|
|
1854
|
+
* decrypt the private key later, so it should be stored securely
|
|
1855
|
+
*
|
|
1856
|
+
* @param {string} secret Secret used to encrypt the private key
|
|
1857
|
+
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
1858
|
+
*/
|
|
1859
|
+
toCiphertext(secret: string): PrivateKeyCiphertext;
|
|
1860
|
+
/**
|
|
1861
|
+
* Get private key from a private key ciphertext and secret originally used to encrypt it
|
|
1862
|
+
*
|
|
1863
|
+
* @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
|
|
1864
|
+
* @param {string} secret Secret originally used to encrypt the private key
|
|
1865
|
+
* @returns {PrivateKey} Private key
|
|
1866
|
+
*/
|
|
1867
|
+
static fromPrivateKeyCiphertext(ciphertext: PrivateKeyCiphertext, secret: string): PrivateKey;
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Private Key in ciphertext form
|
|
1871
|
+
*/
|
|
1872
|
+
export class PrivateKeyCiphertext {
|
|
1873
|
+
private constructor();
|
|
1874
|
+
free(): void;
|
|
1875
|
+
/**
|
|
1876
|
+
* Encrypt a private key using a secret string. The secret is sensitive and will be needed to
|
|
1877
|
+
* decrypt the private key later, so it should be stored securely
|
|
1878
|
+
*
|
|
1879
|
+
* @param {PrivateKey} private_key Private key to encrypt
|
|
1880
|
+
* @param {string} secret Secret to encrypt the private key with
|
|
1881
|
+
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
1882
|
+
*/
|
|
1883
|
+
static encryptPrivateKey(private_key: PrivateKey, secret: string): PrivateKeyCiphertext;
|
|
1884
|
+
/**
|
|
1885
|
+
* Decrypts a private ciphertext using a secret string. This must be the same secret used to
|
|
1886
|
+
* encrypt the private key
|
|
1887
|
+
*
|
|
1888
|
+
* @param {string} secret Secret used to encrypt the private key
|
|
1889
|
+
* @returns {PrivateKey} Private key
|
|
1890
|
+
*/
|
|
1891
|
+
decryptToPrivateKey(secret: string): PrivateKey;
|
|
1892
|
+
/**
|
|
1893
|
+
* Returns the ciphertext string
|
|
1894
|
+
*
|
|
1895
|
+
* @returns {string} Ciphertext string
|
|
1896
|
+
*/
|
|
1897
|
+
toString(): string;
|
|
1898
|
+
/**
|
|
1899
|
+
* Creates a PrivateKeyCiphertext from a string
|
|
1900
|
+
*
|
|
1901
|
+
* @param {string} ciphertext Ciphertext string
|
|
1902
|
+
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
1903
|
+
*/
|
|
1904
|
+
static fromString(ciphertext: string): PrivateKeyCiphertext;
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Webassembly Representation of an Aleo program
|
|
1908
|
+
*/
|
|
1909
|
+
export class Program {
|
|
1910
|
+
private constructor();
|
|
1911
|
+
free(): void;
|
|
1912
|
+
/**
|
|
1913
|
+
* Create a program from a program string
|
|
1914
|
+
*
|
|
1915
|
+
* @param {string} program Aleo program source code
|
|
1916
|
+
* @returns {Program} Program object
|
|
1917
|
+
*/
|
|
1918
|
+
static fromString(program: string): Program;
|
|
1919
|
+
/**
|
|
1920
|
+
* Get a string representation of the program
|
|
1921
|
+
*
|
|
1922
|
+
* @returns {string} String containing the program source code
|
|
1923
|
+
*/
|
|
1924
|
+
toString(): string;
|
|
1925
|
+
/**
|
|
1926
|
+
* Determine if a function is present in the program
|
|
1927
|
+
*
|
|
1928
|
+
* @param {string} functionName Name of the function to check for
|
|
1929
|
+
* @returns {boolean} True if the program is valid, false otherwise
|
|
1930
|
+
*/
|
|
1931
|
+
hasFunction(function_name: string): boolean;
|
|
1932
|
+
/**
|
|
1933
|
+
* Get javascript array of functions names in the program
|
|
1934
|
+
*
|
|
1935
|
+
* @returns {Array} Array of all function names present in the program
|
|
1936
|
+
*
|
|
1937
|
+
* @example
|
|
1938
|
+
* const expected_functions = [
|
|
1939
|
+
* "mint",
|
|
1940
|
+
* "transfer_private",
|
|
1941
|
+
* "transfer_private_to_public",
|
|
1942
|
+
* "transfer_public",
|
|
1943
|
+
* "transfer_public_to_private",
|
|
1944
|
+
* "join",
|
|
1945
|
+
* "split",
|
|
1946
|
+
* "fee"
|
|
1947
|
+
* ]
|
|
1948
|
+
*
|
|
1949
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
1950
|
+
* const credits_functions = credits_program.getFunctions();
|
|
1951
|
+
* console.log(credits_functions === expected_functions); // Output should be "true"
|
|
1952
|
+
*/
|
|
1953
|
+
getFunctions(): Array<any>;
|
|
1954
|
+
/**
|
|
1955
|
+
* Get a javascript object representation of the function inputs and types. This can be used
|
|
1956
|
+
* to generate a web form to capture user inputs for an execution of a function.
|
|
1957
|
+
*
|
|
1958
|
+
* @param {string} function_name Name of the function to get inputs for
|
|
1959
|
+
* @returns {Array} Array of function inputs
|
|
1960
|
+
*
|
|
1961
|
+
* @example
|
|
1962
|
+
* const expected_inputs = [
|
|
1963
|
+
* {
|
|
1964
|
+
* type:"record",
|
|
1965
|
+
* visibility:"private",
|
|
1966
|
+
* record:"credits",
|
|
1967
|
+
* members:[
|
|
1968
|
+
* {
|
|
1969
|
+
* name:"microcredits",
|
|
1970
|
+
* type:"u64",
|
|
1971
|
+
* visibility:"private"
|
|
1972
|
+
* }
|
|
1973
|
+
* ],
|
|
1974
|
+
* register:"r0"
|
|
1975
|
+
* },
|
|
1976
|
+
* {
|
|
1977
|
+
* type:"address",
|
|
1978
|
+
* visibility:"private",
|
|
1979
|
+
* register:"r1"
|
|
1980
|
+
* },
|
|
1981
|
+
* {
|
|
1982
|
+
* type:"u64",
|
|
1983
|
+
* visibility:"private",
|
|
1984
|
+
* register:"r2"
|
|
1985
|
+
* }
|
|
1986
|
+
* ];
|
|
1987
|
+
*
|
|
1988
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
1989
|
+
* const transfer_function_inputs = credits_program.getFunctionInputs("transfer_private");
|
|
1990
|
+
* console.log(transfer_function_inputs === expected_inputs); // Output should be "true"
|
|
1991
|
+
*/
|
|
1992
|
+
getFunctionInputs(function_name: string): Array<any>;
|
|
1993
|
+
/**
|
|
1994
|
+
* Get a the list of a program's mappings and the names/types of their keys and values.
|
|
1995
|
+
*
|
|
1996
|
+
* @returns {Array} - An array of objects representing the mappings in the program
|
|
1997
|
+
* @example
|
|
1998
|
+
* const expected_mappings = [
|
|
1999
|
+
* {
|
|
2000
|
+
* name: "account",
|
|
2001
|
+
* key_name: "owner",
|
|
2002
|
+
* key_type: "address",
|
|
2003
|
+
* value_name: "microcredits",
|
|
2004
|
+
* value_type: "u64"
|
|
2005
|
+
* }
|
|
2006
|
+
* ]
|
|
2007
|
+
*
|
|
2008
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
2009
|
+
* const credits_mappings = credits_program.getMappings();
|
|
2010
|
+
* console.log(credits_mappings === expected_mappings); // Output should be "true"
|
|
2011
|
+
*/
|
|
2012
|
+
getMappings(): Array<any>;
|
|
2013
|
+
/**
|
|
2014
|
+
* Get a javascript object representation of a program record and its types
|
|
2015
|
+
*
|
|
2016
|
+
* @param {string} record_name Name of the record to get members for
|
|
2017
|
+
* @returns {Object} Object containing the record name, type, and members
|
|
2018
|
+
*
|
|
2019
|
+
* @example
|
|
2020
|
+
*
|
|
2021
|
+
* const expected_record = {
|
|
2022
|
+
* type: "record",
|
|
2023
|
+
* record: "Credits",
|
|
2024
|
+
* members: [
|
|
2025
|
+
* {
|
|
2026
|
+
* name: "owner",
|
|
2027
|
+
* type: "address",
|
|
2028
|
+
* visibility: "private"
|
|
2029
|
+
* },
|
|
2030
|
+
* {
|
|
2031
|
+
* name: "microcredits",
|
|
2032
|
+
* type: "u64",
|
|
2033
|
+
* visibility: "private"
|
|
2034
|
+
* }
|
|
2035
|
+
* ];
|
|
2036
|
+
* };
|
|
2037
|
+
*
|
|
2038
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
2039
|
+
* const credits_record = credits_program.getRecordMembers("Credits");
|
|
2040
|
+
* console.log(credits_record === expected_record); // Output should be "true"
|
|
2041
|
+
*/
|
|
2042
|
+
getRecordMembers(record_name: string): object;
|
|
2043
|
+
/**
|
|
2044
|
+
* Get a javascript object representation of a program struct and its types
|
|
2045
|
+
*
|
|
2046
|
+
* @param {string} struct_name Name of the struct to get members for
|
|
2047
|
+
* @returns {Array} Array containing the struct members
|
|
2048
|
+
*
|
|
2049
|
+
* @example
|
|
2050
|
+
*
|
|
2051
|
+
* const STRUCT_PROGRAM = "program token_issue.aleo;
|
|
2052
|
+
*
|
|
2053
|
+
* struct token_metadata:
|
|
2054
|
+
* network as u32;
|
|
2055
|
+
* version as u32;
|
|
2056
|
+
*
|
|
2057
|
+
* struct token:
|
|
2058
|
+
* token_id as u32;
|
|
2059
|
+
* metadata as token_metadata;
|
|
2060
|
+
*
|
|
2061
|
+
* function no_op:
|
|
2062
|
+
* input r0 as u64;
|
|
2063
|
+
* output r0 as u64;"
|
|
2064
|
+
*
|
|
2065
|
+
* const expected_struct_members = [
|
|
2066
|
+
* {
|
|
2067
|
+
* name: "token_id",
|
|
2068
|
+
* type: "u32",
|
|
2069
|
+
* },
|
|
2070
|
+
* {
|
|
2071
|
+
* name: "metadata",
|
|
2072
|
+
* type: "struct",
|
|
2073
|
+
* struct_id: "token_metadata",
|
|
2074
|
+
* members: [
|
|
2075
|
+
* {
|
|
2076
|
+
* name: "network",
|
|
2077
|
+
* type: "u32",
|
|
2078
|
+
* }
|
|
2079
|
+
* {
|
|
2080
|
+
* name: "version",
|
|
2081
|
+
* type: "u32",
|
|
2082
|
+
* }
|
|
2083
|
+
* ]
|
|
2084
|
+
* }
|
|
2085
|
+
* ];
|
|
2086
|
+
*
|
|
2087
|
+
* const program = aleo_wasm.Program.fromString(STRUCT_PROGRAM);
|
|
2088
|
+
* const struct_members = program.getStructMembers("token");
|
|
2089
|
+
* console.log(struct_members === expected_struct_members); // Output should be "true"
|
|
2090
|
+
*/
|
|
2091
|
+
getStructMembers(struct_name: string): Array<any>;
|
|
2092
|
+
/**
|
|
2093
|
+
* Get the credits.aleo program
|
|
2094
|
+
*
|
|
2095
|
+
* @returns {Program} The credits.aleo program
|
|
2096
|
+
*/
|
|
2097
|
+
static getCreditsProgram(): Program;
|
|
2098
|
+
/**
|
|
2099
|
+
* Get the id of the program
|
|
2100
|
+
*
|
|
2101
|
+
* @returns {string} The id of the program
|
|
2102
|
+
*/
|
|
2103
|
+
id(): string;
|
|
2104
|
+
/**
|
|
2105
|
+
* Get a unique address of the program
|
|
2106
|
+
*
|
|
2107
|
+
* @returns {Address} The address of the program
|
|
2108
|
+
*/
|
|
2109
|
+
address(): Address;
|
|
2110
|
+
/**
|
|
2111
|
+
* Determine equality with another program
|
|
2112
|
+
*
|
|
2113
|
+
* @param {Program} other The other program to compare
|
|
2114
|
+
* @returns {boolean} True if the programs are equal, false otherwise
|
|
2115
|
+
*/
|
|
2116
|
+
isEqual(other: Program): boolean;
|
|
2117
|
+
/**
|
|
2118
|
+
* Get program_imports
|
|
2119
|
+
*
|
|
2120
|
+
* @returns {Array} The program imports
|
|
2121
|
+
*
|
|
2122
|
+
* @example
|
|
2123
|
+
*
|
|
2124
|
+
* const DOUBLE_TEST = "import multiply_test.aleo;
|
|
2125
|
+
*
|
|
2126
|
+
* program double_test.aleo;
|
|
2127
|
+
*
|
|
2128
|
+
* function double_it:
|
|
2129
|
+
* input r0 as u32.private;
|
|
2130
|
+
* call multiply_test.aleo/multiply 2u32 r0 into r1;
|
|
2131
|
+
* output r1 as u32.private;";
|
|
2132
|
+
*
|
|
2133
|
+
* const expected_imports = [
|
|
2134
|
+
* "multiply_test.aleo"
|
|
2135
|
+
* ];
|
|
2136
|
+
*
|
|
2137
|
+
* const program = aleo_wasm.Program.fromString(DOUBLE_TEST_PROGRAM);
|
|
2138
|
+
* const imports = program.getImports();
|
|
2139
|
+
* console.log(imports === expected_imports); // Output should be "true"
|
|
2140
|
+
*/
|
|
2141
|
+
getImports(): Array<any>;
|
|
2142
|
+
}
|
|
2143
|
+
export class ProgramManager {
|
|
2144
|
+
private constructor();
|
|
2145
|
+
free(): void;
|
|
2146
|
+
/**
|
|
2147
|
+
* Create an execution `Authorization` for a given program:function tuple with specified inputs.
|
|
2148
|
+
*
|
|
2149
|
+
* @param private_key The private key of the signer.
|
|
2150
|
+
* @param program The program source code containing the function to authorize.
|
|
2151
|
+
* @param function_name The function to authorize.
|
|
2152
|
+
* @param inputs A javascript array of inputs to the function.
|
|
2153
|
+
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2154
|
+
*/
|
|
2155
|
+
static authorize(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null): Promise<Authorization>;
|
|
2156
|
+
/**
|
|
2157
|
+
* Create an execution `Authorization` without generating a circuit. Use this function when
|
|
2158
|
+
* fast delegated proving is needed.
|
|
2159
|
+
*
|
|
2160
|
+
* @param private_key The private key of the signer.
|
|
2161
|
+
* @param program The program source code containing the function to authorize.
|
|
2162
|
+
* @param function_name The function to authorize.
|
|
2163
|
+
* @param inputs A javascript array of inputs to the function.
|
|
2164
|
+
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2165
|
+
*/
|
|
2166
|
+
static buildAuthorizationUnchecked(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null): Promise<Authorization>;
|
|
2167
|
+
/**
|
|
2168
|
+
* Create an `Authorization` for `credits.aleo/fee_public` or `credits.aleo/fee_private`.
|
|
2169
|
+
* This object requires an associated execution or deployment ID. This can be gained from
|
|
2170
|
+
* any previously created authorization by calling (authorization.toExecutionId()).
|
|
2171
|
+
*
|
|
2172
|
+
* @param private_key The private key of the signer.
|
|
2173
|
+
* @param deployment_or_execution_id The id of the deployment or execution to authorize the fee program for.
|
|
2174
|
+
* @param base_fee_credits The base fee to be paid for the authorization
|
|
2175
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
2176
|
+
* @param fee_record The record to spend the fee from
|
|
2177
|
+
* @returns {Authorization}
|
|
2178
|
+
*/
|
|
2179
|
+
static authorizeFee(private_key: PrivateKey, deployment_or_execution_id: string, base_fee_credits: number, priority_fee_credits: number, fee_record?: RecordPlaintext | null): Promise<Authorization>;
|
|
2180
|
+
/**
|
|
2181
|
+
* Deploy an Aleo program
|
|
2182
|
+
*
|
|
2183
|
+
* @param private_key The private key of the sender
|
|
2184
|
+
* @param program The source code of the program being deployed
|
|
2185
|
+
* @param imports A javascript object holding the source code of any imported programs in the
|
|
2186
|
+
* form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
|
|
2187
|
+
* Note that all imported programs must be deployed on chain before the main program in order
|
|
2188
|
+
* for the deployment to succeed
|
|
2189
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
2190
|
+
* @param fee_record The record to spend the fee from
|
|
2191
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
2192
|
+
* @param imports (optional) Provide a list of imports to use for the program deployment in the
|
|
2193
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
2194
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2195
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
2196
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2197
|
+
* @returns {Transaction}
|
|
2198
|
+
*/
|
|
2199
|
+
static buildDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
2200
|
+
/**
|
|
2201
|
+
* Estimate the fee for a program deployment
|
|
2202
|
+
*
|
|
2203
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
2204
|
+
*
|
|
2205
|
+
* @param program The source code of the program being deployed
|
|
2206
|
+
* @param imports (optional) Provide a list of imports to use for the deployment fee estimation
|
|
2207
|
+
* in the form of a javascript object where the keys are a string of the program name and the values
|
|
2208
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2209
|
+
* @returns {u64}
|
|
2210
|
+
*/
|
|
2211
|
+
static estimateDeploymentFee(program: string, imports?: object | null): Promise<bigint>;
|
|
2212
|
+
/**
|
|
2213
|
+
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
2214
|
+
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
2215
|
+
* the cost of the size (in bytes) of the deployment.
|
|
2216
|
+
*
|
|
2217
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
2218
|
+
*
|
|
2219
|
+
* @param name The name of the program to be deployed
|
|
2220
|
+
* @returns {u64}
|
|
2221
|
+
*/
|
|
2222
|
+
static estimateProgramNameCost(name: string): bigint;
|
|
2223
|
+
/**
|
|
2224
|
+
* Execute an arbitrary function locally
|
|
2225
|
+
*
|
|
2226
|
+
* @param {PrivateKey} private_key The private key of the sender
|
|
2227
|
+
* @param {string} program The source code of the program being executed
|
|
2228
|
+
* @param {string} function The name of the function to execute
|
|
2229
|
+
* @param {Array} inputs A javascript array of inputs to the function
|
|
2230
|
+
* @param {boolean} prove_execution If true, the execution will be proven and an execution object
|
|
2231
|
+
* containing the proof and the encrypted inputs and outputs needed to verify the proof offline
|
|
2232
|
+
* will be returned.
|
|
2233
|
+
* @param {boolean} cache Cache the proving and verifying keys in the Execution response.
|
|
2234
|
+
* If this is set to 'true' the keys synthesized will be stored in the Execution Response
|
|
2235
|
+
* and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
|
|
2236
|
+
* method.
|
|
2237
|
+
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
2238
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
2239
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2240
|
+
* @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
|
|
2241
|
+
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
2242
|
+
*/
|
|
2243
|
+
static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, url?: string | null, offline_query?: OfflineQuery | null): Promise<ExecutionResponse>;
|
|
2244
|
+
/**
|
|
2245
|
+
* Execute Aleo function and create an Aleo execution transaction
|
|
2246
|
+
*
|
|
2247
|
+
* @param private_key The private key of the sender
|
|
2248
|
+
* @param program The source code of the program being executed
|
|
2249
|
+
* @param function The name of the function to execute
|
|
2250
|
+
* @param inputs A javascript array of inputs to the function
|
|
2251
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
2252
|
+
* @param fee_record The record to spend the fee from
|
|
2253
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
2254
|
+
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
2255
|
+
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
2256
|
+
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
2257
|
+
* keys will be deallocated from memory after the transaction is executed.
|
|
2258
|
+
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
2259
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
2260
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2261
|
+
* @param proving_key (optional) Provide a verifying key to use for the function execution
|
|
2262
|
+
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
2263
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
2264
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2265
|
+
* @returns {Transaction}
|
|
2266
|
+
*/
|
|
2267
|
+
static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
2268
|
+
/**
|
|
2269
|
+
* Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
|
|
2270
|
+
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
2271
|
+
* program executions.
|
|
2272
|
+
*
|
|
2273
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
2274
|
+
*
|
|
2275
|
+
* @param private_key The private key of the sender
|
|
2276
|
+
* @param program The source code of the program to estimate the execution fee for
|
|
2277
|
+
* @param function The name of the function to execute
|
|
2278
|
+
* @param inputs A javascript array of inputs to the function
|
|
2279
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
2280
|
+
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
2281
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
2282
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2283
|
+
* @param proving_key (optional) Provide a verifying key to use for the fee estimation
|
|
2284
|
+
* @param verifying_key (optional) Provide a verifying key to use for the fee estimation
|
|
2285
|
+
* @returns {u64} Fee in microcredits
|
|
2286
|
+
*/
|
|
2287
|
+
static estimateExecutionFee(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<bigint>;
|
|
2288
|
+
/**
|
|
2289
|
+
* Estimate the finalize fee component for executing a function. This fee is additional to the
|
|
2290
|
+
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
2291
|
+
* step, then the finalize fee is 0.
|
|
2292
|
+
*
|
|
2293
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
2294
|
+
*
|
|
2295
|
+
* @param program The program containing the function to estimate the finalize fee for
|
|
2296
|
+
* @param function The function to estimate the finalize fee for
|
|
2297
|
+
* @returns {u64} Fee in microcredits
|
|
2298
|
+
*/
|
|
2299
|
+
static estimateFinalizeFee(program: string, _function: string): bigint;
|
|
2300
|
+
/**
|
|
2301
|
+
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
2302
|
+
* of the credits of the two original records
|
|
2303
|
+
*
|
|
2304
|
+
* @param private_key The private key of the sender
|
|
2305
|
+
* @param record_1 The first record to combine
|
|
2306
|
+
* @param record_2 The second record to combine
|
|
2307
|
+
* @param priority_fee_credits The opptional priority fee to be paid for the transaction
|
|
2308
|
+
* @param fee_record The record to spend the fee from
|
|
2309
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
2310
|
+
* @param join_proving_key (optional) Provide a proving key to use for the join function
|
|
2311
|
+
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
2312
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
2313
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2314
|
+
* @returns {Transaction} Transaction object
|
|
2315
|
+
*/
|
|
2316
|
+
static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, join_proving_key?: ProvingKey | null, join_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
2317
|
+
/**
|
|
2318
|
+
* Create a `ProvingRequest` object. This object creates authorizations for the top level
|
|
2319
|
+
* function and associated fee function. This object can be sent directly to a remote prover
|
|
2320
|
+
* OR used to extract both execution and fee authorizations.
|
|
2321
|
+
*
|
|
2322
|
+
* @param private_key The private key of the signer.
|
|
2323
|
+
* @param program The program source code containing the function to authorize.
|
|
2324
|
+
* @param function_name The function to authorize.
|
|
2325
|
+
* @param inputs A javascript array of inputs to the function.
|
|
2326
|
+
* @param base_fee_credits The base fee to be paid for the authorization
|
|
2327
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
2328
|
+
* @param fee_record The record to spend the fee from
|
|
2329
|
+
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2330
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
2331
|
+
* @param broadcast (optional) Flag to indicate if the transaction should be broadcast
|
|
2332
|
+
* @returns {Authorization}
|
|
2333
|
+
*/
|
|
2334
|
+
static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean): Promise<ProvingRequest>;
|
|
2335
|
+
/**
|
|
2336
|
+
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
2337
|
+
*
|
|
2338
|
+
* @param private_key The private key of the sender
|
|
2339
|
+
* @param split_amount The amount of the credit split. This amount will be subtracted from the
|
|
2340
|
+
* value of the record and two new records will be created with the split amount and the remainder
|
|
2341
|
+
* @param amount_record The record to split
|
|
2342
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
2343
|
+
* @param split_proving_key (optional) Provide a proving key to use for the split function
|
|
2344
|
+
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
2345
|
+
* @returns {Transaction} Transaction object
|
|
2346
|
+
*/
|
|
2347
|
+
static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url?: string | null, split_proving_key?: ProvingKey | null, split_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
2348
|
+
/**
|
|
2349
|
+
* Send credits from one Aleo account to another
|
|
2350
|
+
*
|
|
2351
|
+
* @param private_key The private key of the sender
|
|
2352
|
+
* @param amount_credits The amount of credits to send
|
|
2353
|
+
* @param recipient The recipient of the transaction
|
|
2354
|
+
* @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
|
|
2355
|
+
* @param amount_record The record to fund the amount from
|
|
2356
|
+
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
2357
|
+
* @param fee_record The record to spend the fee from
|
|
2358
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
2359
|
+
* @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
|
|
2360
|
+
* function
|
|
2361
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
2362
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
2363
|
+
* @returns {Transaction}
|
|
2364
|
+
*/
|
|
2365
|
+
static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | null | undefined, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, transfer_proving_key?: ProvingKey | null, transfer_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
2366
|
+
/**
|
|
2367
|
+
* Synthesize proving and verifying keys for a program
|
|
2368
|
+
*
|
|
2369
|
+
* @param program {string} The program source code of the program to synthesize keys for
|
|
2370
|
+
* @param function_id {string} The function to synthesize keys for
|
|
2371
|
+
* @param inputs {Array} The inputs to the function
|
|
2372
|
+
* @param imports {Object | undefined} The imports for the program
|
|
2373
|
+
*/
|
|
2374
|
+
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null): Promise<KeyPair>;
|
|
2375
|
+
}
|
|
2376
|
+
/**
|
|
2377
|
+
* Proving key for a function within an Aleo program
|
|
2378
|
+
*/
|
|
2379
|
+
export class ProvingKey {
|
|
2380
|
+
private constructor();
|
|
2381
|
+
free(): void;
|
|
2382
|
+
/**
|
|
2383
|
+
* Verify if the proving key is for the bond_public function
|
|
2384
|
+
*
|
|
2385
|
+
* @example
|
|
2386
|
+
* const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
|
|
2387
|
+
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2388
|
+
*
|
|
2389
|
+
* @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
|
|
2390
|
+
*/
|
|
2391
|
+
isBondPublicProver(): boolean;
|
|
2392
|
+
/**
|
|
2393
|
+
* Verify if the proving key is for the bond_validator function
|
|
2394
|
+
*
|
|
2395
|
+
* @example
|
|
2396
|
+
* const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
|
|
2397
|
+
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2398
|
+
*
|
|
2399
|
+
* @returns {boolean} returns true if the proving key is for the bond_validator function, false if otherwise
|
|
2400
|
+
*/
|
|
2401
|
+
isBondValidatorProver(): boolean;
|
|
2402
|
+
/**
|
|
2403
|
+
* Verify if the proving key is for the claim_unbond function
|
|
2404
|
+
*
|
|
2405
|
+
* @example
|
|
2406
|
+
* const provingKey = ProvingKey.fromBytes("claim_unbond_proving_key.bin");
|
|
2407
|
+
* provingKey.isClaimUnbondProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2408
|
+
*
|
|
2409
|
+
* @returns {boolean} returns true if the proving key is for the claim_unbond function, false if otherwise
|
|
2410
|
+
*/
|
|
2411
|
+
isClaimUnbondPublicProver(): boolean;
|
|
2412
|
+
/**
|
|
2413
|
+
* Verify if the proving key is for the fee_private function
|
|
2414
|
+
*
|
|
2415
|
+
* @example
|
|
2416
|
+
* const provingKey = ProvingKey.fromBytes("fee_private_proving_key.bin");
|
|
2417
|
+
* provingKey.isFeePrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2418
|
+
*
|
|
2419
|
+
* @returns {boolean} returns true if the proving key is for the fee_private function, false if otherwise
|
|
2420
|
+
*/
|
|
2421
|
+
isFeePrivateProver(): boolean;
|
|
2422
|
+
/**
|
|
2423
|
+
* Verify if the proving key is for the fee_public function
|
|
2424
|
+
*
|
|
2425
|
+
* @example
|
|
2426
|
+
* const provingKey = ProvingKey.fromBytes("fee_public_proving_key.bin");
|
|
2427
|
+
* provingKey.isFeePublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2428
|
+
*
|
|
2429
|
+
* @returns {boolean} returns true if the proving key is for the fee_public function, false if otherwise
|
|
2430
|
+
*/
|
|
2431
|
+
isFeePublicProver(): boolean;
|
|
2432
|
+
/**
|
|
2433
|
+
* Verify if the proving key is for the inclusion function
|
|
2434
|
+
*
|
|
2435
|
+
* @example
|
|
2436
|
+
* const provingKey = ProvingKey.fromBytes("inclusion_proving_key.bin");
|
|
2437
|
+
* provingKey.isInclusionProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2438
|
+
*
|
|
2439
|
+
* @returns {boolean} returns true if the proving key is for the inclusion function, false if otherwise
|
|
2440
|
+
*/
|
|
2441
|
+
isInclusionProver(): boolean;
|
|
2442
|
+
/**
|
|
2443
|
+
* Verify if the proving key is for the join function
|
|
2444
|
+
*
|
|
2445
|
+
* @example
|
|
2446
|
+
* const provingKey = ProvingKey.fromBytes("join_proving_key.bin");
|
|
2447
|
+
* provingKey.isJoinProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2448
|
+
*
|
|
2449
|
+
* @returns {boolean} returns true if the proving key is for the join function, false if otherwise
|
|
2450
|
+
*/
|
|
2451
|
+
isJoinProver(): boolean;
|
|
2452
|
+
/**
|
|
2453
|
+
* Verify if the proving key is for the set_validator_state function
|
|
2454
|
+
*
|
|
2455
|
+
* @example
|
|
2456
|
+
* const provingKey = ProvingKey.fromBytes("set_validator_set_proving_key.bin");
|
|
2457
|
+
* provingKey.isSetValidatorStateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2458
|
+
*
|
|
2459
|
+
* @returns {boolean} returns true if the proving key is for the set_validator_state function, false if otherwise
|
|
2460
|
+
*/
|
|
2461
|
+
isSetValidatorStateProver(): boolean;
|
|
2462
|
+
/**
|
|
2463
|
+
* Verify if the proving key is for the split function
|
|
2464
|
+
*
|
|
2465
|
+
* @example
|
|
2466
|
+
* const provingKey = ProvingKey.fromBytes("split_proving_key.bin");
|
|
2467
|
+
* provingKey.isSplitProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2468
|
+
*
|
|
2469
|
+
* @returns {boolean} returns true if the proving key is for the split function, false if otherwise
|
|
2470
|
+
*/
|
|
2471
|
+
isSplitProver(): boolean;
|
|
2472
|
+
/**
|
|
2473
|
+
* Verify if the proving key is for the transfer_private function
|
|
2474
|
+
*
|
|
2475
|
+
* @example
|
|
2476
|
+
* const provingKey = ProvingKey.fromBytes("transfer_private_proving_key.bin");
|
|
2477
|
+
* provingKey.isTransferPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2478
|
+
*
|
|
2479
|
+
* @returns {boolean} returns true if the proving key is for the transfer_private function, false if otherwise
|
|
2480
|
+
*/
|
|
2481
|
+
isTransferPrivateProver(): boolean;
|
|
2482
|
+
/**
|
|
2483
|
+
* Verify if the proving key is for the transfer_private_to_public function
|
|
2484
|
+
*
|
|
2485
|
+
* @example
|
|
2486
|
+
* const provingKey = ProvingKey.fromBytes("transfer_private_to_public_proving_key.bin");
|
|
2487
|
+
* provingKey.isTransferPrivateToPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2488
|
+
*
|
|
2489
|
+
* @returns {boolean} returns true if the proving key is for the transfer_private_to_public function, false if otherwise
|
|
2490
|
+
*/
|
|
2491
|
+
isTransferPrivateToPublicProver(): boolean;
|
|
2492
|
+
/**
|
|
2493
|
+
* Verify if the proving key is for the transfer_public function
|
|
2494
|
+
*
|
|
2495
|
+
* @example
|
|
2496
|
+
* const provingKey = ProvingKey.fromBytes("transfer_public_proving_key.bin");
|
|
2497
|
+
* provingKey.isTransferPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2498
|
+
*
|
|
2499
|
+
* @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
|
|
2500
|
+
*/
|
|
2501
|
+
isTransferPublicProver(): boolean;
|
|
2502
|
+
/**
|
|
2503
|
+
* Verify if the proving key is for the transfer_public_as_signer function
|
|
2504
|
+
*
|
|
2505
|
+
* @example
|
|
2506
|
+
* const provingKey = ProvingKey.fromBytes("transfer_public_as_signer_proving_key.bin");
|
|
2507
|
+
* provingKey.isTransferPublicAsSignerProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2508
|
+
*
|
|
2509
|
+
* @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
|
|
2510
|
+
*/
|
|
2511
|
+
isTransferPublicAsSignerProver(): boolean;
|
|
2512
|
+
/**
|
|
2513
|
+
* Verify if the proving key is for the transfer_public_to_private function
|
|
2514
|
+
*
|
|
2515
|
+
* @example
|
|
2516
|
+
* const provingKey = ProvingKey.fromBytes("transfer_public_to_private_proving_key.bin");
|
|
2517
|
+
* provingKey.isTransferPublicToPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2518
|
+
*
|
|
2519
|
+
* @returns {boolean} returns true if the proving key is for the transfer_public_to_private function, false if otherwise
|
|
2520
|
+
*/
|
|
2521
|
+
isTransferPublicToPrivateProver(): boolean;
|
|
2522
|
+
/**
|
|
2523
|
+
* Verify if the proving key is for the unbond_public function
|
|
2524
|
+
*
|
|
2525
|
+
* @example
|
|
2526
|
+
* const provingKey = ProvingKey.fromBytes("unbond_public.bin");
|
|
2527
|
+
* provingKey.isUnbondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
2528
|
+
*
|
|
2529
|
+
* @returns {boolean} returns true if the proving key is for the unbond_public_prover function, false if otherwise
|
|
2530
|
+
*/
|
|
2531
|
+
isUnbondPublicProver(): boolean;
|
|
2532
|
+
/**
|
|
2533
|
+
* Return the checksum of the proving key
|
|
2534
|
+
*
|
|
2535
|
+
* @returns {string} Checksum of the proving key
|
|
2536
|
+
*/
|
|
2537
|
+
checksum(): string;
|
|
2538
|
+
/**
|
|
2539
|
+
* Create a copy of the proving key
|
|
2540
|
+
*
|
|
2541
|
+
* @returns {ProvingKey} A copy of the proving key
|
|
2542
|
+
*/
|
|
2543
|
+
copy(): ProvingKey;
|
|
2544
|
+
/**
|
|
2545
|
+
* Construct a new proving key from a byte array
|
|
2546
|
+
*
|
|
2547
|
+
* @param {Uint8Array} bytes Byte array representation of a proving key
|
|
2548
|
+
* @returns {ProvingKey}
|
|
2549
|
+
*/
|
|
2550
|
+
static fromBytes(bytes: Uint8Array): ProvingKey;
|
|
2551
|
+
/**
|
|
2552
|
+
* Create a proving key from string
|
|
2553
|
+
*
|
|
2554
|
+
* @param {string} String representation of the proving key
|
|
2555
|
+
*/
|
|
2556
|
+
static fromString(string: string): ProvingKey;
|
|
2557
|
+
/**
|
|
2558
|
+
* Return the byte representation of a proving key
|
|
2559
|
+
*
|
|
2560
|
+
* @returns {Uint8Array} Byte array representation of a proving key
|
|
2561
|
+
*/
|
|
2562
|
+
toBytes(): Uint8Array;
|
|
2563
|
+
/**
|
|
2564
|
+
* Get a string representation of the proving key
|
|
2565
|
+
*
|
|
2566
|
+
* @returns {string} String representation of the proving key
|
|
2567
|
+
*/
|
|
2568
|
+
toString(): string;
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Represents a proving request to a prover.
|
|
2572
|
+
*/
|
|
2573
|
+
export class ProvingRequest {
|
|
2574
|
+
private constructor();
|
|
2575
|
+
free(): void;
|
|
2576
|
+
/**
|
|
2577
|
+
* Creates a new ProvingRequest from a function Authorization and an optional fee Authorization.
|
|
2578
|
+
*
|
|
2579
|
+
* @param {Authorization} authorization An Authorization for a function.
|
|
2580
|
+
* @param {Authorization} fee_authorization The authorization for the `credits.aleo/fee_public` or `credits.aleo/fee_private` function that pays the fee for the execution of the main function.
|
|
2581
|
+
* @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
|
|
2582
|
+
*/
|
|
2583
|
+
static new(authorization: Authorization, fee_authorization: Authorization | null | undefined, broadcast: boolean): ProvingRequest;
|
|
2584
|
+
/**
|
|
2585
|
+
* Creates a ProvingRequest from a string representation.
|
|
2586
|
+
*
|
|
2587
|
+
* @param {Uint8Array} request String representation of the ProvingRequest.
|
|
2588
|
+
*/
|
|
2589
|
+
static fromString(request: string): ProvingRequest;
|
|
2590
|
+
/**
|
|
2591
|
+
* Creates a string representation of the ProvingRequest.
|
|
2592
|
+
*/
|
|
2593
|
+
toString(): string;
|
|
2594
|
+
/**
|
|
2595
|
+
* Creates a ProvingRequest from a left-endian byte representation of the ProvingRequest.
|
|
1497
2596
|
*
|
|
1498
|
-
* @param {
|
|
1499
|
-
|
|
2597
|
+
* @param {Uint8Array} bytes Left-endian bytes representing the proving request.
|
|
2598
|
+
*/
|
|
2599
|
+
static fromBytesLe(bytes: Uint8Array): ProvingRequest;
|
|
2600
|
+
/**
|
|
2601
|
+
* Creates a left-endian byte representation of the ProvingRequest.
|
|
2602
|
+
*/
|
|
2603
|
+
toBytesLe(): Uint8Array;
|
|
2604
|
+
/**
|
|
2605
|
+
* Get the Authorization of the main function in the ProvingRequest.
|
|
2606
|
+
*/
|
|
2607
|
+
authorization(): Authorization;
|
|
2608
|
+
/**
|
|
2609
|
+
* Get the fee Authorization in the ProvingRequest.
|
|
2610
|
+
*/
|
|
2611
|
+
feeAuthorization(): Authorization | undefined;
|
|
2612
|
+
/**
|
|
2613
|
+
* Get the broadcast flag set in the ProvingRequest.
|
|
2614
|
+
*/
|
|
2615
|
+
broadcast(): boolean;
|
|
2616
|
+
/**
|
|
2617
|
+
* Check if a ProvingRequest is the same as another ProvingRequest.
|
|
2618
|
+
*/
|
|
2619
|
+
equals(other: ProvingRequest): boolean;
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* Encrypted Aleo record
|
|
2623
|
+
*/
|
|
2624
|
+
export class RecordCiphertext {
|
|
2625
|
+
private constructor();
|
|
2626
|
+
free(): void;
|
|
2627
|
+
/**
|
|
2628
|
+
* Create a record ciphertext from a string
|
|
1500
2629
|
*
|
|
1501
|
-
* @
|
|
2630
|
+
* @param {string} record String representation of a record ciphertext
|
|
2631
|
+
* @returns {RecordCiphertext} Record ciphertext
|
|
2632
|
+
*/
|
|
2633
|
+
static fromString(record: string): RecordCiphertext;
|
|
2634
|
+
/**
|
|
2635
|
+
* Return the string representation of the record ciphertext
|
|
1502
2636
|
*
|
|
1503
|
-
*
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
*
|
|
1508
|
-
*
|
|
1509
|
-
* type: "address",
|
|
1510
|
-
* visibility: "private"
|
|
1511
|
-
* },
|
|
1512
|
-
* {
|
|
1513
|
-
* name: "microcredits",
|
|
1514
|
-
* type: "u64",
|
|
1515
|
-
* visibility: "private"
|
|
1516
|
-
* }
|
|
1517
|
-
* ];
|
|
1518
|
-
* };
|
|
2637
|
+
* @returns {string} String representation of the record ciphertext
|
|
2638
|
+
*/
|
|
2639
|
+
toString(): string;
|
|
2640
|
+
/**
|
|
2641
|
+
* Decrypt the record ciphertext into plaintext using the view key. The record will only
|
|
2642
|
+
* decrypt if the record was encrypted by the account corresponding to the view key
|
|
1519
2643
|
*
|
|
1520
|
-
*
|
|
1521
|
-
*
|
|
1522
|
-
* console.log(credits_record === expected_record); // Output should be "true"
|
|
2644
|
+
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
2645
|
+
* @returns {RecordPlaintext} Record plaintext object
|
|
1523
2646
|
*/
|
|
1524
|
-
|
|
2647
|
+
decrypt(view_key: ViewKey): RecordPlaintext;
|
|
1525
2648
|
/**
|
|
1526
|
-
*
|
|
2649
|
+
* Generate the record view key. The record view key can only decrypt record if the
|
|
2650
|
+
* supplied view key belongs to the record owner.
|
|
1527
2651
|
*
|
|
1528
|
-
* @param {
|
|
1529
|
-
*
|
|
2652
|
+
* @param {ViewKey} view_key View key used to generate the record view key
|
|
2653
|
+
*
|
|
2654
|
+
* @returns {Group} record view key
|
|
2655
|
+
*/
|
|
2656
|
+
recordViewKey(view_key: ViewKey): Field;
|
|
2657
|
+
/**
|
|
2658
|
+
* Determines if the account corresponding to the view key is the owner of the record
|
|
2659
|
+
*
|
|
2660
|
+
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
2661
|
+
* @returns {boolean}
|
|
2662
|
+
*/
|
|
2663
|
+
isOwner(view_key: ViewKey): boolean;
|
|
2664
|
+
/**
|
|
2665
|
+
* Get the tag of the record using the graph key.
|
|
2666
|
+
*
|
|
2667
|
+
* @param {GraphKey} graph key of the account associatd with the record.
|
|
2668
|
+
* @param {Field} commitment of the record.
|
|
2669
|
+
*
|
|
2670
|
+
* @returns {Field} tag of the record.
|
|
2671
|
+
*/
|
|
2672
|
+
static tag(graph_key: GraphKey, commitment: Field): Field;
|
|
2673
|
+
/**
|
|
2674
|
+
* Get a record ciphertext object from a series of bytes.
|
|
2675
|
+
*
|
|
2676
|
+
* @param {Uint8Array} bytes A left endian byte array representing the record ciphertext.
|
|
2677
|
+
*
|
|
2678
|
+
* @returns {RecordCiphertext}
|
|
2679
|
+
*/
|
|
2680
|
+
static fromBytesLe(bytes: Uint8Array): RecordCiphertext;
|
|
2681
|
+
/**
|
|
2682
|
+
* Get the left endian byte array representation of the record ciphertext.
|
|
2683
|
+
*
|
|
2684
|
+
* @returns {Uint8Array} Left endian byte array representation of the record ciphertext.
|
|
2685
|
+
*/
|
|
2686
|
+
toBytesLe(): Uint8Array;
|
|
2687
|
+
/**
|
|
2688
|
+
* Get the left endian boolean array representation of the record ciphertext bits.
|
|
2689
|
+
*
|
|
2690
|
+
* returns {Array} Left endian boolean array representation of the bits of the record ciphertext.
|
|
2691
|
+
*/
|
|
2692
|
+
toBitsLe(): Array<any>;
|
|
2693
|
+
/**
|
|
2694
|
+
* Get the field array representation of the record ciphertext.
|
|
2695
|
+
*
|
|
2696
|
+
* @returns {Array} Field array representation of the record ciphertext.
|
|
2697
|
+
*/
|
|
2698
|
+
toFields(): Array<any>;
|
|
2699
|
+
/**
|
|
2700
|
+
* Decrypt the record ciphertext into plaintext using a record view key.
|
|
2701
|
+
*
|
|
2702
|
+
* @param {Field} record_vk Record view key used to decrypt the record.
|
|
2703
|
+
*
|
|
2704
|
+
* @returns {RecordPlaintext}
|
|
2705
|
+
*/
|
|
2706
|
+
decryptWithRecordViewKey(record_vk: Field): RecordPlaintext;
|
|
2707
|
+
/**
|
|
2708
|
+
* Get the record nonce.
|
|
2709
|
+
*
|
|
2710
|
+
* @returns {Group} The record nonce.
|
|
2711
|
+
*/
|
|
2712
|
+
nonce(): Group;
|
|
2713
|
+
/**
|
|
2714
|
+
* Clone the RecordCiphertext WASM object.
|
|
2715
|
+
*
|
|
2716
|
+
* @returns {RecordCiphertext} A clone of the RecordCiphertext WASM object.
|
|
2717
|
+
*/
|
|
2718
|
+
clone(): RecordCiphertext;
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* Plaintext representation of an Aleo record
|
|
2722
|
+
*/
|
|
2723
|
+
export class RecordPlaintext {
|
|
2724
|
+
private constructor();
|
|
2725
|
+
free(): void;
|
|
2726
|
+
commitment(program_id: string, record_name: string, record_view_key: string): Field;
|
|
2727
|
+
/**
|
|
2728
|
+
* Return a record plaintext from a string.
|
|
2729
|
+
*
|
|
2730
|
+
* @param {string} record String representation of a plaintext representation of an Aleo record.
|
|
2731
|
+
*
|
|
2732
|
+
* @returns {RecordPlaintext} Record plaintext
|
|
2733
|
+
*/
|
|
2734
|
+
static fromString(record: string): RecordPlaintext;
|
|
2735
|
+
/**
|
|
2736
|
+
* Get the record entry matching a key.
|
|
2737
|
+
*
|
|
2738
|
+
* @param {string} input The key to retrieve the value in the record data field.
|
|
2739
|
+
*
|
|
2740
|
+
* @returns {Plaintext} The plaintext value corresponding to the key.
|
|
2741
|
+
*/
|
|
2742
|
+
getMember(input: string): Plaintext;
|
|
2743
|
+
/**
|
|
2744
|
+
* Get the owner of the record.
|
|
2745
|
+
*
|
|
2746
|
+
* @returns {Address} Address of the owner of the record.
|
|
2747
|
+
*/
|
|
2748
|
+
owner(): Address;
|
|
2749
|
+
/**
|
|
2750
|
+
* Get a representation of a record as a javascript object for usage in client side
|
|
2751
|
+
* computations. Note that this is not a reversible operation and exists for the convenience
|
|
2752
|
+
* of discovering and using properties of the record.
|
|
2753
|
+
*
|
|
2754
|
+
* The conversion guide is as follows:
|
|
2755
|
+
* - u8, u16, u32, i8, i16 i32 --> Number
|
|
2756
|
+
* - u64, u128, i64, i128 --> BigInt
|
|
2757
|
+
* - Address, Field, Group, Scalar --> String.
|
|
2758
|
+
*
|
|
2759
|
+
* Address, Field, Group, and Scalar will all be converted to their bech32 string
|
|
2760
|
+
* representation. These string representations can be converted back to their respective wasm
|
|
2761
|
+
* types using the fromString method on the Address, Field, Group, and Scalar objects in this
|
|
2762
|
+
* library.
|
|
1530
2763
|
*
|
|
1531
2764
|
* @example
|
|
2765
|
+
* # Create a wasm record from a record string.
|
|
2766
|
+
* let record_plaintext_wasm = RecordPlainext.from_string("{
|
|
2767
|
+
* owner: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
2768
|
+
* metadata: {
|
|
2769
|
+
* player1: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
2770
|
+
* player2: aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6.private,
|
|
2771
|
+
* nonce: 660310649780728486489183263981322848354071976582883879926426319832534836534field.private
|
|
2772
|
+
* },
|
|
2773
|
+
* id: 1953278585719525811355617404139099418855053112960441725284031425961000152405field.private,
|
|
2774
|
+
* positions: 50794271u64.private,
|
|
2775
|
+
* attempts: 0u64.private,
|
|
2776
|
+
* hits: 0u64.private,
|
|
2777
|
+
* _nonce: 5668100912391182624073500093436664635767788874314097667746354181784048204413group.public
|
|
2778
|
+
* }");
|
|
2779
|
+
*
|
|
2780
|
+
* let expected_object = {
|
|
2781
|
+
* owner: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
2782
|
+
* metadata: {
|
|
2783
|
+
* player1: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
2784
|
+
* player2: "aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6",
|
|
2785
|
+
* nonce: "660310649780728486489183263981322848354071976582883879926426319832534836534field"
|
|
2786
|
+
* },
|
|
2787
|
+
* id: "1953278585719525811355617404139099418855053112960441725284031425961000152405field",
|
|
2788
|
+
* positions: 50794271,
|
|
2789
|
+
* attempts: 0,
|
|
2790
|
+
* hits: 0,
|
|
2791
|
+
* _nonce: "5668100912391182624073500093436664635767788874314097667746354181784048204413group"
|
|
2792
|
+
* };
|
|
2793
|
+
*
|
|
2794
|
+
* # Create the expected object
|
|
2795
|
+
* let record_plaintext_object = record_plaintext_wasm.to_js_object();
|
|
2796
|
+
* assert(JSON.stringify(record_plaintext_object) == JSON.stringify(expected_object));
|
|
2797
|
+
*
|
|
2798
|
+
* @returns {Object} Javascript object representation of the record
|
|
2799
|
+
*/
|
|
2800
|
+
toJsObject(): object;
|
|
2801
|
+
/**
|
|
2802
|
+
* Returns the record plaintext string
|
|
2803
|
+
*
|
|
2804
|
+
* @returns {string} String representation of the record plaintext
|
|
2805
|
+
*/
|
|
2806
|
+
toString(): string;
|
|
2807
|
+
/**
|
|
2808
|
+
* Get a record plaintext object from a series of bytes.
|
|
2809
|
+
*
|
|
2810
|
+
* @param {Uint8Array} bytes A left endian byte array representing the record plaintext.
|
|
2811
|
+
*
|
|
2812
|
+
* @returns {RecordPlaintext} The record plaintext.
|
|
2813
|
+
*/
|
|
2814
|
+
static fromBytesLe(bytes: Uint8Array): RecordPlaintext;
|
|
2815
|
+
/**
|
|
2816
|
+
* Returns the left endian byte array representation of the record plaintext.
|
|
2817
|
+
*
|
|
2818
|
+
* @returns {Uint8Array} Byte array representation of the record plaintext.
|
|
2819
|
+
*/
|
|
2820
|
+
toBytesLe(): Uint8Array;
|
|
2821
|
+
/**
|
|
2822
|
+
* Returns the left endian boolean array representation of the record plaintext bits.
|
|
2823
|
+
*
|
|
2824
|
+
* @returns {Array} Boolean array representation of the record plaintext bits.
|
|
2825
|
+
*/
|
|
2826
|
+
toBitsLe(): Array<any>;
|
|
2827
|
+
/**
|
|
2828
|
+
* Get the field array representation of the record plaintext.
|
|
2829
|
+
*/
|
|
2830
|
+
toFields(): Array<any>;
|
|
2831
|
+
/**
|
|
2832
|
+
* Returns the amount of microcredits in the record
|
|
1532
2833
|
*
|
|
1533
|
-
*
|
|
2834
|
+
* @returns {u64} Amount of microcredits in the record
|
|
2835
|
+
*/
|
|
2836
|
+
microcredits(): bigint;
|
|
2837
|
+
/**
|
|
2838
|
+
* Returns the nonce of the record. This can be used to uniquely identify a record.
|
|
1534
2839
|
*
|
|
1535
|
-
*
|
|
1536
|
-
|
|
1537
|
-
|
|
2840
|
+
* @returns {string} Nonce of the record
|
|
2841
|
+
*/
|
|
2842
|
+
nonce(): string;
|
|
2843
|
+
/**
|
|
2844
|
+
* Attempt to get the serial number of a record to determine whether or not is has been spent
|
|
1538
2845
|
*
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
*
|
|
2846
|
+
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
2847
|
+
* @param {string} program_id Program ID of the program that the record is associated with
|
|
2848
|
+
* @param {string} record_name Name of the record
|
|
2849
|
+
* @param {string} record_view_key The string representation of the record view key.
|
|
1542
2850
|
*
|
|
1543
|
-
*
|
|
1544
|
-
|
|
1545
|
-
|
|
2851
|
+
* @returns {string} Serial number of the record
|
|
2852
|
+
*/
|
|
2853
|
+
serialNumberString(private_key: PrivateKey, program_id: string, record_name: string, record_view_key: string): string;
|
|
2854
|
+
/**
|
|
2855
|
+
* Get the tag of the record using the graph key.
|
|
2856
|
+
*/
|
|
2857
|
+
tag(graph_key: GraphKey, commitment: Field): Field;
|
|
2858
|
+
/**
|
|
2859
|
+
* Generate the record view key. The record view key can only decrypt record if the
|
|
2860
|
+
* supplied view key belongs to the record owner.
|
|
1546
2861
|
*
|
|
1547
|
-
*
|
|
1548
|
-
* {
|
|
1549
|
-
* name: "token_id",
|
|
1550
|
-
* type: "u32",
|
|
1551
|
-
* },
|
|
1552
|
-
* {
|
|
1553
|
-
* name: "metadata",
|
|
1554
|
-
* type: "struct",
|
|
1555
|
-
* struct_id: "token_metadata",
|
|
1556
|
-
* members: [
|
|
1557
|
-
* {
|
|
1558
|
-
* name: "network",
|
|
1559
|
-
* type: "u32",
|
|
1560
|
-
* }
|
|
1561
|
-
* {
|
|
1562
|
-
* name: "version",
|
|
1563
|
-
* type: "u32",
|
|
1564
|
-
* }
|
|
1565
|
-
* ]
|
|
1566
|
-
* }
|
|
1567
|
-
* ];
|
|
2862
|
+
* @param {ViewKey} view_key View key used to generate the record view key
|
|
1568
2863
|
*
|
|
1569
|
-
*
|
|
1570
|
-
* const struct_members = program.getStructMembers("token");
|
|
1571
|
-
* console.log(struct_members === expected_struct_members); // Output should be "true"
|
|
2864
|
+
* @returns {Group} record view key
|
|
1572
2865
|
*/
|
|
1573
|
-
|
|
2866
|
+
recordViewKey(view_key: ViewKey): Field;
|
|
1574
2867
|
/**
|
|
1575
|
-
*
|
|
2868
|
+
* Clone the RecordPlaintext WASM object.
|
|
1576
2869
|
*
|
|
1577
|
-
* @returns {
|
|
2870
|
+
* @returns {RecordPlaintext} A clone of the RecordPlaintext WASM object.
|
|
1578
2871
|
*/
|
|
1579
|
-
|
|
2872
|
+
clone(): RecordPlaintext;
|
|
2873
|
+
}
|
|
2874
|
+
/**
|
|
2875
|
+
* Scalar field element.
|
|
2876
|
+
*/
|
|
2877
|
+
export class Scalar {
|
|
2878
|
+
private constructor();
|
|
2879
|
+
free(): void;
|
|
1580
2880
|
/**
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
* @returns {string} The id of the program
|
|
2881
|
+
* Creates a scalar object from a string representation of a scalar element.
|
|
1584
2882
|
*/
|
|
1585
|
-
|
|
2883
|
+
static fromString(group: string): Scalar;
|
|
1586
2884
|
/**
|
|
1587
|
-
*
|
|
2885
|
+
* Returns the string representation of the scalar element.
|
|
2886
|
+
*/
|
|
2887
|
+
toString(): string;
|
|
2888
|
+
/**
|
|
2889
|
+
* Create a scalar element from a Uint8Array of left endian bytes.
|
|
2890
|
+
*/
|
|
2891
|
+
static fromBytesLe(bytes: Uint8Array): Scalar;
|
|
2892
|
+
/**
|
|
2893
|
+
* Encode the scalar element as a Uint8Array of left endian bytes.
|
|
2894
|
+
*/
|
|
2895
|
+
toBytesLe(): Uint8Array;
|
|
2896
|
+
/**
|
|
2897
|
+
* Reconstruct a scalar element from a boolean array representation.
|
|
2898
|
+
*/
|
|
2899
|
+
static fromBitsLe(bits: Array<any>): Scalar;
|
|
2900
|
+
/**
|
|
2901
|
+
* Get the left endian boolean array representation of the scalar element.
|
|
2902
|
+
*/
|
|
2903
|
+
toBitsLe(): Array<any>;
|
|
2904
|
+
/**
|
|
2905
|
+
* Create a plaintext element from a scalar element.
|
|
2906
|
+
*/
|
|
2907
|
+
toPlaintext(): Plaintext;
|
|
2908
|
+
/**
|
|
2909
|
+
* Clone the scalar element.
|
|
2910
|
+
*/
|
|
2911
|
+
clone(): Scalar;
|
|
2912
|
+
/**
|
|
2913
|
+
* Generate a random scalar element.
|
|
2914
|
+
*/
|
|
2915
|
+
static random(): Scalar;
|
|
2916
|
+
/**
|
|
2917
|
+
* Add two scalar elements.
|
|
2918
|
+
*/
|
|
2919
|
+
add(other: Scalar): Scalar;
|
|
2920
|
+
/**
|
|
2921
|
+
* Subtract two scalar elements.
|
|
2922
|
+
*/
|
|
2923
|
+
subtract(other: Scalar): Scalar;
|
|
2924
|
+
/**
|
|
2925
|
+
* Multiply two scalar elements.
|
|
2926
|
+
*/
|
|
2927
|
+
multiply(other: Scalar): Scalar;
|
|
2928
|
+
/**
|
|
2929
|
+
* Divide two scalar elements.
|
|
2930
|
+
*/
|
|
2931
|
+
divide(other: Scalar): Scalar;
|
|
2932
|
+
/**
|
|
2933
|
+
* Double the scalar element.
|
|
2934
|
+
*/
|
|
2935
|
+
double(): Scalar;
|
|
2936
|
+
/**
|
|
2937
|
+
* Power of a scalar element.
|
|
2938
|
+
*/
|
|
2939
|
+
pow(other: Scalar): Scalar;
|
|
2940
|
+
/**
|
|
2941
|
+
* Invert the scalar element.
|
|
2942
|
+
*/
|
|
2943
|
+
inverse(): Scalar;
|
|
2944
|
+
/**
|
|
2945
|
+
* Get the multiplicative identity of the scalar field.
|
|
2946
|
+
*/
|
|
2947
|
+
static one(): Scalar;
|
|
2948
|
+
/**
|
|
2949
|
+
* Get the additive identity of the scalar field.
|
|
2950
|
+
*/
|
|
2951
|
+
static zero(): Scalar;
|
|
2952
|
+
/**
|
|
2953
|
+
* Check if one scalar element equals another.
|
|
2954
|
+
*/
|
|
2955
|
+
equals(other: Scalar): boolean;
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* Cryptographic signature of a message signed by an Aleo account
|
|
2959
|
+
*/
|
|
2960
|
+
export class Signature {
|
|
2961
|
+
private constructor();
|
|
2962
|
+
free(): void;
|
|
2963
|
+
/**
|
|
2964
|
+
* Sign a message with a private key
|
|
1588
2965
|
*
|
|
1589
|
-
* @
|
|
2966
|
+
* @param {PrivateKey} private_key The private key to sign the message with
|
|
2967
|
+
* @param {Uint8Array} message Byte representation of the message to sign
|
|
2968
|
+
* @returns {Signature} Signature of the message
|
|
1590
2969
|
*/
|
|
1591
|
-
|
|
2970
|
+
static sign(private_key: PrivateKey, message: Uint8Array): Signature;
|
|
1592
2971
|
/**
|
|
1593
|
-
*
|
|
2972
|
+
* Get an address from a signature.
|
|
1594
2973
|
*
|
|
1595
|
-
* @
|
|
1596
|
-
* @returns {boolean} True if the programs are equal, false otherwise
|
|
2974
|
+
* @returns {Address} Address object
|
|
1597
2975
|
*/
|
|
1598
|
-
|
|
2976
|
+
to_address(): Address;
|
|
1599
2977
|
/**
|
|
1600
|
-
* Get
|
|
2978
|
+
* Get the challenge of a signature.
|
|
2979
|
+
*/
|
|
2980
|
+
challenge(): Scalar;
|
|
2981
|
+
/**
|
|
2982
|
+
* Get the response of a signature.
|
|
2983
|
+
*/
|
|
2984
|
+
response(): Scalar;
|
|
2985
|
+
/**
|
|
2986
|
+
* Verify a signature of a message with an address
|
|
1601
2987
|
*
|
|
1602
|
-
* @
|
|
2988
|
+
* @param {Address} address The address to verify the signature with
|
|
2989
|
+
* @param {Uint8Array} message Byte representation of the message to verify
|
|
2990
|
+
* @returns {boolean} True if the signature is valid, false otherwise
|
|
2991
|
+
*/
|
|
2992
|
+
verify(address: Address, message: Uint8Array): boolean;
|
|
2993
|
+
/**
|
|
2994
|
+
* Get a signature from a series of bytes.
|
|
1603
2995
|
*
|
|
1604
|
-
* @
|
|
2996
|
+
* @param {Uint8Array} bytes A left endian byte array representing the signature.
|
|
1605
2997
|
*
|
|
1606
|
-
*
|
|
2998
|
+
* @returns {Signature} The signature object.
|
|
2999
|
+
*/
|
|
3000
|
+
static fromBytesLe(bytes: Uint8Array): Signature;
|
|
3001
|
+
/**
|
|
3002
|
+
* Get the left endian byte array representation of the signature.
|
|
3003
|
+
*/
|
|
3004
|
+
toBytesLe(): Uint8Array;
|
|
3005
|
+
/**
|
|
3006
|
+
* Get a signature from a series of bits represented as a boolean array.
|
|
1607
3007
|
*
|
|
1608
|
-
*
|
|
3008
|
+
* @param {Array} bits A left endian boolean array representing the bits of the signature.
|
|
1609
3009
|
*
|
|
1610
|
-
*
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
3010
|
+
* @returns {Signature} The signature object.
|
|
3011
|
+
*/
|
|
3012
|
+
static fromBitsLe(bits: Array<any>): Signature;
|
|
3013
|
+
/**
|
|
3014
|
+
* Get the left endian boolean array representation of the bits of the signature.
|
|
3015
|
+
*/
|
|
3016
|
+
toBitsLe(): Array<any>;
|
|
3017
|
+
/**
|
|
3018
|
+
* Get the field array representation of the signature.
|
|
3019
|
+
*/
|
|
3020
|
+
toFields(): Array<any>;
|
|
3021
|
+
/**
|
|
3022
|
+
* Get a signature from a string representation of a signature
|
|
1614
3023
|
*
|
|
1615
|
-
*
|
|
1616
|
-
*
|
|
1617
|
-
|
|
3024
|
+
* @param {string} signature String representation of a signature
|
|
3025
|
+
* @returns {Signature} Signature
|
|
3026
|
+
*/
|
|
3027
|
+
static from_string(signature: string): Signature;
|
|
3028
|
+
/**
|
|
3029
|
+
* Get a string representation of a signature
|
|
1618
3030
|
*
|
|
1619
|
-
*
|
|
1620
|
-
* const imports = program.getImports();
|
|
1621
|
-
* console.log(imports === expected_imports); // Output should be "true"
|
|
3031
|
+
* @returns {string} String representation of a signature
|
|
1622
3032
|
*/
|
|
1623
|
-
|
|
3033
|
+
to_string(): string;
|
|
3034
|
+
/**
|
|
3035
|
+
* Get the plaintext representation of the signature.
|
|
3036
|
+
*/
|
|
3037
|
+
toPlaintext(): Plaintext;
|
|
1624
3038
|
}
|
|
1625
|
-
|
|
3039
|
+
/**
|
|
3040
|
+
* Webassembly Representation of an Aleo transaction
|
|
3041
|
+
*
|
|
3042
|
+
* This object is created when generating an on-chain function deployment or execution and is the
|
|
3043
|
+
* object that should be submitted to the Aleo Network in order to deploy or execute a function.
|
|
3044
|
+
*/
|
|
3045
|
+
export class Transaction {
|
|
1626
3046
|
private constructor();
|
|
1627
3047
|
free(): void;
|
|
1628
3048
|
/**
|
|
1629
|
-
* Create
|
|
3049
|
+
* Create a transaction from a string
|
|
3050
|
+
*
|
|
3051
|
+
* @param {string} transaction String representation of a transaction
|
|
3052
|
+
* @returns {Transaction}
|
|
3053
|
+
*/
|
|
3054
|
+
static fromString(transaction: string): Transaction;
|
|
3055
|
+
/**
|
|
3056
|
+
* Create a transaction from a Uint8Array of left endian bytes.
|
|
1630
3057
|
*
|
|
1631
|
-
* @param
|
|
1632
|
-
* @
|
|
1633
|
-
* @param function_name The function to authorize.
|
|
1634
|
-
* @param inputs A javascript array of inputs to the function.
|
|
1635
|
-
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
3058
|
+
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transaction.
|
|
3059
|
+
* @returns {Transaction}
|
|
1636
3060
|
*/
|
|
1637
|
-
static
|
|
3061
|
+
static fromBytesLe(bytes: Uint8Array): Transaction;
|
|
1638
3062
|
/**
|
|
1639
|
-
*
|
|
1640
|
-
*
|
|
3063
|
+
* Get the transaction as a string. If you want to submit this transaction to the Aleo Network
|
|
3064
|
+
* this function will create the string that should be submitted in the `POST` data.
|
|
1641
3065
|
*
|
|
1642
|
-
* @
|
|
1643
|
-
* @param program The program source code containing the function to authorize.
|
|
1644
|
-
* @param function_name The function to authorize.
|
|
1645
|
-
* @param inputs A javascript array of inputs to the function.
|
|
1646
|
-
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
3066
|
+
* @returns {string} String representation of the transaction
|
|
1647
3067
|
*/
|
|
1648
|
-
|
|
3068
|
+
toString(): string;
|
|
1649
3069
|
/**
|
|
1650
|
-
*
|
|
1651
|
-
* This object requires an associated execution or deployment ID. This can be gained from
|
|
1652
|
-
* any previously created authorization by calling (authorization.toExecutionId()).
|
|
3070
|
+
* Get the transaction as a Uint8Array of left endian bytes.
|
|
1653
3071
|
*
|
|
1654
|
-
* @
|
|
1655
|
-
* @param deployment_or_execution_id The id of the deployment or execution to authorize the fee program for.
|
|
1656
|
-
* @param base_fee_credits The base fee to be paid for the authorization
|
|
1657
|
-
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
1658
|
-
* @param fee_record The record to spend the fee from
|
|
1659
|
-
* @returns {Authorization}
|
|
3072
|
+
* @returns {Uint8Array} Uint8Array representation of the transaction
|
|
1660
3073
|
*/
|
|
1661
|
-
|
|
3074
|
+
toBytesLe(): Uint8Array;
|
|
1662
3075
|
/**
|
|
1663
|
-
*
|
|
3076
|
+
* Returns true if the transaction contains the given serial number.
|
|
1664
3077
|
*
|
|
1665
|
-
* @param
|
|
1666
|
-
* @param program The source code of the program being deployed
|
|
1667
|
-
* @param imports A javascript object holding the source code of any imported programs in the
|
|
1668
|
-
* form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
|
|
1669
|
-
* Note that all imported programs must be deployed on chain before the main program in order
|
|
1670
|
-
* for the deployment to succeed
|
|
1671
|
-
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
1672
|
-
* @param fee_record The record to spend the fee from
|
|
1673
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1674
|
-
* @param imports (optional) Provide a list of imports to use for the program deployment in the
|
|
1675
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
1676
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1677
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1678
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1679
|
-
* @returns {Transaction}
|
|
3078
|
+
* @param {boolean} True if the transaction contains the given serial number.
|
|
1680
3079
|
*/
|
|
1681
|
-
|
|
3080
|
+
constainsSerialNumber(serial_number: Field): boolean;
|
|
1682
3081
|
/**
|
|
1683
|
-
*
|
|
1684
|
-
*
|
|
1685
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
3082
|
+
* Returns true if the transaction contains the given commitment.
|
|
1686
3083
|
*
|
|
1687
|
-
* @param
|
|
1688
|
-
* @param imports (optional) Provide a list of imports to use for the deployment fee estimation
|
|
1689
|
-
* in the form of a javascript object where the keys are a string of the program name and the values
|
|
1690
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1691
|
-
* @returns {u64}
|
|
3084
|
+
* @param {boolean} True if the transaction contains the given commitment.
|
|
1692
3085
|
*/
|
|
1693
|
-
|
|
3086
|
+
constainsCommitment(commitment: Field): boolean;
|
|
1694
3087
|
/**
|
|
1695
|
-
*
|
|
1696
|
-
|
|
1697
|
-
|
|
3088
|
+
* Find a record in the transaction by the record's commitment.
|
|
3089
|
+
*/
|
|
3090
|
+
findRecord(commitment: Field): RecordCiphertext | undefined;
|
|
3091
|
+
/**
|
|
3092
|
+
* Returns the transaction's base fee.
|
|
3093
|
+
*/
|
|
3094
|
+
baseFeeAmount(): bigint;
|
|
3095
|
+
/**
|
|
3096
|
+
* Returns the transaction's total fee.
|
|
3097
|
+
*/
|
|
3098
|
+
feeAmount(): bigint;
|
|
3099
|
+
/**
|
|
3100
|
+
* Returns the transaction's priority fee.
|
|
1698
3101
|
*
|
|
1699
|
-
*
|
|
3102
|
+
* returns {bigint} The transaction's priority fee.
|
|
3103
|
+
*/
|
|
3104
|
+
priorityFeeAmount(): bigint;
|
|
3105
|
+
/**
|
|
3106
|
+
* Returns true if the transaction is a deployment transaction.
|
|
1700
3107
|
*
|
|
1701
|
-
* @
|
|
1702
|
-
* @returns {u64}
|
|
3108
|
+
* @returns {boolean} True if the transaction is a deployment transaction
|
|
1703
3109
|
*/
|
|
1704
|
-
|
|
3110
|
+
isDeploy(): boolean;
|
|
1705
3111
|
/**
|
|
1706
|
-
*
|
|
3112
|
+
* Returns true if the transaction is an execution transaction.
|
|
1707
3113
|
*
|
|
1708
|
-
* @
|
|
1709
|
-
* @param {string} program The source code of the program being executed
|
|
1710
|
-
* @param {string} function The name of the function to execute
|
|
1711
|
-
* @param {Array} inputs A javascript array of inputs to the function
|
|
1712
|
-
* @param {boolean} prove_execution If true, the execution will be proven and an execution object
|
|
1713
|
-
* containing the proof and the encrypted inputs and outputs needed to verify the proof offline
|
|
1714
|
-
* will be returned.
|
|
1715
|
-
* @param {boolean} cache Cache the proving and verifying keys in the Execution response.
|
|
1716
|
-
* If this is set to 'true' the keys synthesized will be stored in the Execution Response
|
|
1717
|
-
* and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
|
|
1718
|
-
* method.
|
|
1719
|
-
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
1720
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
1721
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1722
|
-
* @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
|
|
1723
|
-
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
3114
|
+
* @returns {boolean} True if the transaction is an execution transaction
|
|
1724
3115
|
*/
|
|
1725
|
-
|
|
3116
|
+
isExecute(): boolean;
|
|
1726
3117
|
/**
|
|
1727
|
-
*
|
|
3118
|
+
* Returns true if the transaction is a fee transaction.
|
|
1728
3119
|
*
|
|
1729
|
-
* @
|
|
1730
|
-
* @param program The source code of the program being executed
|
|
1731
|
-
* @param function The name of the function to execute
|
|
1732
|
-
* @param inputs A javascript array of inputs to the function
|
|
1733
|
-
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
1734
|
-
* @param fee_record The record to spend the fee from
|
|
1735
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1736
|
-
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
1737
|
-
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
1738
|
-
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
1739
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
1740
|
-
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
1741
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
1742
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1743
|
-
* @param proving_key (optional) Provide a verifying key to use for the function execution
|
|
1744
|
-
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
1745
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1746
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1747
|
-
* @returns {Transaction}
|
|
3120
|
+
* @returns {boolean} True if the transaction is a fee transaction
|
|
1748
3121
|
*/
|
|
1749
|
-
|
|
3122
|
+
isFee(): boolean;
|
|
1750
3123
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
* program executions.
|
|
3124
|
+
* Returns the program deployed within the transaction if the transaction is a deployment
|
|
3125
|
+
* transaction.
|
|
1754
3126
|
*
|
|
1755
|
-
*
|
|
3127
|
+
* @returns {Program | undefined} The program deployed within the transaction.
|
|
3128
|
+
*/
|
|
3129
|
+
deployedProgram(): Program | undefined;
|
|
3130
|
+
/**
|
|
3131
|
+
* Returns the execution within the transaction (if present).
|
|
1756
3132
|
*
|
|
1757
|
-
* @
|
|
1758
|
-
* @param program The source code of the program to estimate the execution fee for
|
|
1759
|
-
* @param function The name of the function to execute
|
|
1760
|
-
* @param inputs A javascript array of inputs to the function
|
|
1761
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1762
|
-
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
1763
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
1764
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1765
|
-
* @param proving_key (optional) Provide a verifying key to use for the fee estimation
|
|
1766
|
-
* @param verifying_key (optional) Provide a verifying key to use for the fee estimation
|
|
1767
|
-
* @returns {u64} Fee in microcredits
|
|
3133
|
+
* @returns {Execution | undefined} The execution within the transaction.
|
|
1768
3134
|
*/
|
|
1769
|
-
|
|
3135
|
+
execution(): Execution | undefined;
|
|
1770
3136
|
/**
|
|
1771
|
-
*
|
|
1772
|
-
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
1773
|
-
* step, then the finalize fee is 0.
|
|
3137
|
+
* Get the record plaintext present in a transaction owned by a specific view key.
|
|
1774
3138
|
*
|
|
1775
|
-
*
|
|
3139
|
+
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
1776
3140
|
*
|
|
1777
|
-
* @
|
|
1778
|
-
* @param function The function to estimate the finalize fee for
|
|
1779
|
-
* @returns {u64} Fee in microcredits
|
|
3141
|
+
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
1780
3142
|
*/
|
|
1781
|
-
|
|
3143
|
+
ownedRecords(view_key: ViewKey): Array<any>;
|
|
1782
3144
|
/**
|
|
1783
|
-
*
|
|
1784
|
-
* of the credits of the two original records
|
|
3145
|
+
* Get the records present in a transaction and their commitments.
|
|
1785
3146
|
*
|
|
1786
|
-
* @
|
|
1787
|
-
* @param record_1 The first record to combine
|
|
1788
|
-
* @param record_2 The second record to combine
|
|
1789
|
-
* @param priority_fee_credits The opptional priority fee to be paid for the transaction
|
|
1790
|
-
* @param fee_record The record to spend the fee from
|
|
1791
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1792
|
-
* @param join_proving_key (optional) Provide a proving key to use for the join function
|
|
1793
|
-
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
1794
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1795
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1796
|
-
* @returns {Transaction} Transaction object
|
|
3147
|
+
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
1797
3148
|
*/
|
|
1798
|
-
|
|
3149
|
+
records(): Array<any>;
|
|
1799
3150
|
/**
|
|
1800
|
-
*
|
|
1801
|
-
* function and associated fee function. This object can be sent directly to a remote prover
|
|
1802
|
-
* OR used to extract both execution and fee authorizations.
|
|
3151
|
+
* Get a summary of the transaction within a javascript object.
|
|
1803
3152
|
*
|
|
1804
|
-
*
|
|
1805
|
-
*
|
|
1806
|
-
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
* @param
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
1813
|
-
* @
|
|
1814
|
-
* @returns {Authorization}
|
|
3153
|
+
* If the transaction is an execution transaction, this function will return a list of the
|
|
3154
|
+
* transitions and their inputs and outputs.
|
|
3155
|
+
*
|
|
3156
|
+
* If the transaction is a deployment transaction, this function will return the program id and
|
|
3157
|
+
* a list of the functions and their verifying keys, constraint, and variable counts.
|
|
3158
|
+
*
|
|
3159
|
+
* @param {boolean} convert_to_js If true the inputs and outputs will be converted to JS objects,
|
|
3160
|
+
* if false the inputs and outputs will be in wasm format.
|
|
3161
|
+
*
|
|
3162
|
+
* @returns {Object} Transaction summary
|
|
1815
3163
|
*/
|
|
1816
|
-
|
|
3164
|
+
summary(convert_to_js: boolean): object;
|
|
1817
3165
|
/**
|
|
1818
|
-
*
|
|
3166
|
+
* Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
|
|
1819
3167
|
*
|
|
1820
|
-
*
|
|
1821
|
-
*
|
|
1822
|
-
* value
|
|
1823
|
-
*
|
|
1824
|
-
* @
|
|
1825
|
-
* @param split_proving_key (optional) Provide a proving key to use for the split function
|
|
1826
|
-
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
1827
|
-
* @returns {Transaction} Transaction object
|
|
3168
|
+
* This value can be used to query the status of the transaction on the Aleo Network to see
|
|
3169
|
+
* if it was successful. If successful, the transaction will be included in a block and this
|
|
3170
|
+
* value can be used to lookup the transaction data on-chain.
|
|
3171
|
+
*
|
|
3172
|
+
* @returns {string} TransactionId
|
|
1828
3173
|
*/
|
|
1829
|
-
|
|
3174
|
+
id(): string;
|
|
1830
3175
|
/**
|
|
1831
|
-
*
|
|
1832
|
-
*
|
|
1833
|
-
* @
|
|
1834
|
-
* @param amount_credits The amount of credits to send
|
|
1835
|
-
* @param recipient The recipient of the transaction
|
|
1836
|
-
* @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
|
|
1837
|
-
* @param amount_record The record to fund the amount from
|
|
1838
|
-
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
1839
|
-
* @param fee_record The record to spend the fee from
|
|
1840
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1841
|
-
* @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
|
|
1842
|
-
* function
|
|
1843
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1844
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1845
|
-
* @returns {Transaction}
|
|
3176
|
+
* Get the type of the transaction (will return "deploy" or "execute")
|
|
3177
|
+
*
|
|
3178
|
+
* @returns {string} Transaction type
|
|
1846
3179
|
*/
|
|
1847
|
-
|
|
3180
|
+
transactionType(): string;
|
|
1848
3181
|
/**
|
|
1849
|
-
*
|
|
3182
|
+
* Get the transitions in a transaction.
|
|
1850
3183
|
*
|
|
1851
|
-
* @
|
|
1852
|
-
* @param {string} function_id The function to synthesize keys for
|
|
1853
|
-
* @param {Array} inputs The inputs to the function
|
|
1854
|
-
* @param {Object | undefined} imports The imports for the program
|
|
3184
|
+
* @returns {Array<Transition>} Array of transition objects
|
|
1855
3185
|
*/
|
|
1856
|
-
|
|
1857
|
-
|
|
3186
|
+
transitions(): Array<any>;
|
|
3187
|
+
/**
|
|
3188
|
+
* Get the verifying keys in a transaction.
|
|
3189
|
+
*
|
|
3190
|
+
* @returns {Array<Object>} Array of verifying keys.
|
|
3191
|
+
*/
|
|
3192
|
+
verifyingKeys(): Array<any>;
|
|
1858
3193
|
}
|
|
1859
|
-
|
|
1860
|
-
* Proving key for a function within an Aleo program
|
|
1861
|
-
*/
|
|
1862
|
-
export class ProvingKey {
|
|
3194
|
+
export class Transition {
|
|
1863
3195
|
private constructor();
|
|
1864
3196
|
free(): void;
|
|
1865
3197
|
/**
|
|
1866
|
-
*
|
|
1867
|
-
*
|
|
1868
|
-
* @example
|
|
1869
|
-
* const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
|
|
1870
|
-
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3198
|
+
* Get the transition ID
|
|
1871
3199
|
*
|
|
1872
|
-
* @returns {
|
|
3200
|
+
* @returns {string} The transition ID
|
|
1873
3201
|
*/
|
|
1874
|
-
|
|
3202
|
+
id(): string;
|
|
1875
3203
|
/**
|
|
1876
|
-
*
|
|
1877
|
-
*
|
|
1878
|
-
* @example
|
|
1879
|
-
* const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
|
|
1880
|
-
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3204
|
+
* Create a transition from a string
|
|
1881
3205
|
*
|
|
1882
|
-
* @
|
|
3206
|
+
* @param {string} transition String representation of a transition
|
|
3207
|
+
* @returns {Transition}
|
|
1883
3208
|
*/
|
|
1884
|
-
|
|
3209
|
+
static fromString(transition: string): Transition;
|
|
1885
3210
|
/**
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
1888
|
-
* @example
|
|
1889
|
-
* const provingKey = ProvingKey.fromBytes("claim_unbond_proving_key.bin");
|
|
1890
|
-
* provingKey.isClaimUnbondProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3211
|
+
* Create a transition from a Uint8Array of left endian bytes.
|
|
1891
3212
|
*
|
|
1892
|
-
* @
|
|
3213
|
+
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transition.
|
|
3214
|
+
* @returns {Transition}
|
|
1893
3215
|
*/
|
|
1894
|
-
|
|
3216
|
+
static fromBytesLe(bytes: Uint8Array): Transition;
|
|
1895
3217
|
/**
|
|
1896
|
-
*
|
|
1897
|
-
*
|
|
1898
|
-
* @example
|
|
1899
|
-
* const provingKey = ProvingKey.fromBytes("fee_private_proving_key.bin");
|
|
1900
|
-
* provingKey.isFeePrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3218
|
+
* Get the transition as a string. If you want to submit this transition to the Aleo Network
|
|
3219
|
+
* this function will create the string that should be submitted in the `POST` data.
|
|
1901
3220
|
*
|
|
1902
|
-
* @returns {
|
|
3221
|
+
* @returns {string} String representation of the transition
|
|
1903
3222
|
*/
|
|
1904
|
-
|
|
3223
|
+
toString(): string;
|
|
1905
3224
|
/**
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
1908
|
-
* @example
|
|
1909
|
-
* const provingKey = ProvingKey.fromBytes("fee_public_proving_key.bin");
|
|
1910
|
-
* provingKey.isFeePublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3225
|
+
* Get the transition as a Uint8Array of left endian bytes.
|
|
1911
3226
|
*
|
|
1912
|
-
* @returns {
|
|
3227
|
+
* @returns {Uint8Array} Uint8Array representation of the transition
|
|
1913
3228
|
*/
|
|
1914
|
-
|
|
3229
|
+
toBytesLe(): Uint8Array;
|
|
1915
3230
|
/**
|
|
1916
|
-
*
|
|
1917
|
-
*
|
|
1918
|
-
* @example
|
|
1919
|
-
* const provingKey = ProvingKey.fromBytes("inclusion_proving_key.bin");
|
|
1920
|
-
* provingKey.isInclusionProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1921
|
-
*
|
|
1922
|
-
* @returns {boolean} returns true if the proving key is for the inclusion function, false if otherwise
|
|
3231
|
+
* Get the program ID of the transition.
|
|
1923
3232
|
*/
|
|
1924
|
-
|
|
3233
|
+
programId(): string;
|
|
1925
3234
|
/**
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
* @example
|
|
1929
|
-
* const provingKey = ProvingKey.fromBytes("join_proving_key.bin");
|
|
1930
|
-
* provingKey.isJoinProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1931
|
-
*
|
|
1932
|
-
* @returns {boolean} returns true if the proving key is for the join function, false if otherwise
|
|
3235
|
+
* Get the function name of the transition.
|
|
1933
3236
|
*/
|
|
1934
|
-
|
|
3237
|
+
functionName(): string;
|
|
1935
3238
|
/**
|
|
1936
|
-
*
|
|
1937
|
-
*
|
|
1938
|
-
* @example
|
|
1939
|
-
* const provingKey = ProvingKey.fromBytes("set_validator_set_proving_key.bin");
|
|
1940
|
-
* provingKey.isSetValidatorStateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3239
|
+
* Returns true if the transition contains the given commitment.
|
|
1941
3240
|
*
|
|
1942
|
-
* @
|
|
3241
|
+
* @param {boolean} True if the transition contains the given commitment.
|
|
1943
3242
|
*/
|
|
1944
|
-
|
|
3243
|
+
containsCommitment(commitment: Field): boolean;
|
|
1945
3244
|
/**
|
|
1946
|
-
*
|
|
3245
|
+
* Check if the transition contains a serial number.
|
|
1947
3246
|
*
|
|
1948
|
-
* @
|
|
1949
|
-
* const provingKey = ProvingKey.fromBytes("split_proving_key.bin");
|
|
1950
|
-
* provingKey.isSplitProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3247
|
+
* @param {Field} serial_number The serial number to check for
|
|
1951
3248
|
*
|
|
1952
|
-
* @returns {
|
|
3249
|
+
* @returns {bool} True if the transition contains a serial number, false otherwise
|
|
1953
3250
|
*/
|
|
1954
|
-
|
|
3251
|
+
containsSerialNumber(serial_number: Field): boolean;
|
|
1955
3252
|
/**
|
|
1956
|
-
*
|
|
1957
|
-
*
|
|
1958
|
-
* @example
|
|
1959
|
-
* const provingKey = ProvingKey.fromBytes("transfer_private_proving_key.bin");
|
|
1960
|
-
* provingKey.isTransferPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1961
|
-
*
|
|
1962
|
-
* @returns {boolean} returns true if the proving key is for the transfer_private function, false if otherwise
|
|
3253
|
+
* Find a record in the transition by the record's commitment.
|
|
1963
3254
|
*/
|
|
1964
|
-
|
|
3255
|
+
findRecord(commitment: Field): RecordCiphertext | undefined;
|
|
1965
3256
|
/**
|
|
1966
|
-
*
|
|
3257
|
+
* Get the record plaintext present in a transition owned by a specific view key.
|
|
1967
3258
|
*
|
|
1968
|
-
* @
|
|
1969
|
-
* const provingKey = ProvingKey.fromBytes("transfer_private_to_public_proving_key.bin");
|
|
1970
|
-
* provingKey.isTransferPrivateToPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3259
|
+
* @param {ViewKey} view_key The view key of the record owner.
|
|
1971
3260
|
*
|
|
1972
|
-
* @returns {
|
|
3261
|
+
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
1973
3262
|
*/
|
|
1974
|
-
|
|
3263
|
+
ownedRecords(view_key: ViewKey): Array<any>;
|
|
1975
3264
|
/**
|
|
1976
|
-
*
|
|
1977
|
-
*
|
|
1978
|
-
* @example
|
|
1979
|
-
* const provingKey = ProvingKey.fromBytes("transfer_public_proving_key.bin");
|
|
1980
|
-
* provingKey.isTransferPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3265
|
+
* Get the records present in a transition and their commitments.
|
|
1981
3266
|
*
|
|
1982
|
-
* @returns {
|
|
3267
|
+
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
1983
3268
|
*/
|
|
1984
|
-
|
|
3269
|
+
records(): Array<any>;
|
|
1985
3270
|
/**
|
|
1986
|
-
*
|
|
3271
|
+
* Get the inputs of the transition.
|
|
1987
3272
|
*
|
|
1988
|
-
* @
|
|
1989
|
-
*
|
|
1990
|
-
* provingKey.isTransferPublicAsSignerProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3273
|
+
* @param {bool} convert_to_js If true the inputs will be converted to JS objects, if false
|
|
3274
|
+
* the inputs will be in wasm format.
|
|
1991
3275
|
*
|
|
1992
|
-
* @returns {
|
|
3276
|
+
* @returns {Array} Array of inputs
|
|
1993
3277
|
*/
|
|
1994
|
-
|
|
3278
|
+
inputs(convert_to_js: boolean): Array<any>;
|
|
1995
3279
|
/**
|
|
1996
|
-
*
|
|
3280
|
+
* Get the outputs of the transition.
|
|
1997
3281
|
*
|
|
1998
|
-
* @
|
|
1999
|
-
*
|
|
2000
|
-
* provingKey.isTransferPublicToPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3282
|
+
* @param {bool} convert_to_js If true the outputs will be converted to JS objects, if false
|
|
3283
|
+
* the outputs will be in wasm format.
|
|
2001
3284
|
*
|
|
2002
|
-
* @returns {
|
|
3285
|
+
* @returns {Array} Array of outputs
|
|
2003
3286
|
*/
|
|
2004
|
-
|
|
3287
|
+
outputs(convert_to_js: boolean): Array<any>;
|
|
2005
3288
|
/**
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2008
|
-
* @example
|
|
2009
|
-
* const provingKey = ProvingKey.fromBytes("unbond_public.bin");
|
|
2010
|
-
* provingKey.isUnbondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
3289
|
+
* Get the transition public key of the transition.
|
|
2011
3290
|
*
|
|
2012
|
-
* @returns {
|
|
3291
|
+
* @returns {Group} Transition public key
|
|
2013
3292
|
*/
|
|
2014
|
-
|
|
3293
|
+
tpk(): Group;
|
|
2015
3294
|
/**
|
|
2016
|
-
*
|
|
3295
|
+
* Get the transition view key of the transition.
|
|
2017
3296
|
*
|
|
2018
|
-
* @
|
|
2019
|
-
*/
|
|
2020
|
-
checksum(): string;
|
|
2021
|
-
/**
|
|
2022
|
-
* Create a copy of the proving key
|
|
3297
|
+
* @param {ViewKey} view_key The view key of the transition signer.
|
|
2023
3298
|
*
|
|
2024
|
-
* @returns {
|
|
3299
|
+
* @returns {Field} Transition view key
|
|
2025
3300
|
*/
|
|
2026
|
-
|
|
3301
|
+
tvk(view_key: ViewKey): Field;
|
|
2027
3302
|
/**
|
|
2028
|
-
*
|
|
3303
|
+
* Get the transition commitment of the transition.
|
|
2029
3304
|
*
|
|
2030
|
-
* @
|
|
2031
|
-
* @returns {ProvingKey}
|
|
3305
|
+
* @returns {Field} Transition commitment
|
|
2032
3306
|
*/
|
|
2033
|
-
|
|
3307
|
+
tcm(): Field;
|
|
2034
3308
|
/**
|
|
2035
|
-
*
|
|
3309
|
+
* Get the transition signer commitment of the transition.
|
|
2036
3310
|
*
|
|
2037
|
-
* @
|
|
3311
|
+
* @returns {Field} Transition signer commitment
|
|
2038
3312
|
*/
|
|
2039
|
-
|
|
3313
|
+
scm(): Field;
|
|
2040
3314
|
/**
|
|
2041
|
-
*
|
|
3315
|
+
* Decrypt the transition using the transition view key.
|
|
2042
3316
|
*
|
|
2043
|
-
* @
|
|
2044
|
-
*/
|
|
2045
|
-
toBytes(): Uint8Array;
|
|
2046
|
-
/**
|
|
2047
|
-
* Get a string representation of the proving key
|
|
3317
|
+
* @param {Field} tvk The transition view key.
|
|
2048
3318
|
*
|
|
2049
|
-
* @returns {
|
|
3319
|
+
* @returns {Transition} The transition with public values for inputs and outputs.
|
|
2050
3320
|
*/
|
|
2051
|
-
|
|
3321
|
+
decryptTransition(tvk: Field): Transition;
|
|
2052
3322
|
}
|
|
2053
|
-
|
|
2054
|
-
* Represents a proving request to a prover.
|
|
2055
|
-
*/
|
|
2056
|
-
export class ProvingRequest {
|
|
3323
|
+
export class U128 {
|
|
2057
3324
|
private constructor();
|
|
2058
3325
|
free(): void;
|
|
2059
3326
|
/**
|
|
2060
|
-
* Creates
|
|
2061
|
-
*
|
|
2062
|
-
* @param {Authorization} authorization An Authorization for a function.
|
|
2063
|
-
* @param {Authorization} fee_authorization The authorization for the `credits.aleo/fee_public` or `credits.aleo/fee_private` function that pays the fee for the execution of the main function.
|
|
2064
|
-
* @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
|
|
2065
|
-
*/
|
|
2066
|
-
static new(authorization: Authorization, fee_authorization: Authorization | null | undefined, broadcast: boolean): ProvingRequest;
|
|
2067
|
-
/**
|
|
2068
|
-
* Creates a ProvingRequest from a string representation.
|
|
2069
|
-
*
|
|
2070
|
-
* @param {Uint8Array} request String representation of the ProvingRequest.
|
|
3327
|
+
* Creates from string.
|
|
2071
3328
|
*/
|
|
2072
|
-
static fromString(
|
|
3329
|
+
static fromString(s: string): U128;
|
|
2073
3330
|
/**
|
|
2074
|
-
*
|
|
3331
|
+
* To string.
|
|
2075
3332
|
*/
|
|
2076
3333
|
toString(): string;
|
|
2077
3334
|
/**
|
|
2078
|
-
*
|
|
2079
|
-
*
|
|
2080
|
-
* @param {Uint8Array} bytes Left-endian bytes representing the proving request.
|
|
3335
|
+
* From bytes (LE).
|
|
2081
3336
|
*/
|
|
2082
|
-
static fromBytesLe(bytes: Uint8Array):
|
|
3337
|
+
static fromBytesLe(bytes: Uint8Array): U128;
|
|
2083
3338
|
/**
|
|
2084
|
-
*
|
|
3339
|
+
* To bytes (LE).
|
|
2085
3340
|
*/
|
|
2086
3341
|
toBytesLe(): Uint8Array;
|
|
2087
3342
|
/**
|
|
2088
|
-
*
|
|
3343
|
+
* From bits.
|
|
2089
3344
|
*/
|
|
2090
|
-
|
|
3345
|
+
static fromBitsLe(bits: Array<any>): U128;
|
|
2091
3346
|
/**
|
|
2092
|
-
*
|
|
3347
|
+
* To bits.
|
|
2093
3348
|
*/
|
|
2094
|
-
|
|
3349
|
+
toBitsLe(): Array<any>;
|
|
2095
3350
|
/**
|
|
2096
|
-
*
|
|
3351
|
+
* Checked absolute value.
|
|
2097
3352
|
*/
|
|
2098
|
-
|
|
3353
|
+
absChecked(): U128;
|
|
2099
3354
|
/**
|
|
2100
|
-
*
|
|
3355
|
+
* Wrapped absolute value.
|
|
2101
3356
|
*/
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
3357
|
+
absWrapped(): U128;
|
|
3358
|
+
/**
|
|
3359
|
+
* Wrapped addition.
|
|
3360
|
+
*/
|
|
3361
|
+
addWrapped(other: U128): U128;
|
|
3362
|
+
/**
|
|
3363
|
+
* Wrapped subtraction.
|
|
3364
|
+
*/
|
|
3365
|
+
subWrapped(other: U128): U128;
|
|
3366
|
+
/**
|
|
3367
|
+
* Wrapped multiplication.
|
|
3368
|
+
*/
|
|
3369
|
+
mulWrapped(other: U128): U128;
|
|
2110
3370
|
/**
|
|
2111
|
-
*
|
|
2112
|
-
*
|
|
2113
|
-
* @param {string} record String representation of a record ciphertext
|
|
2114
|
-
* @returns {RecordCiphertext} Record ciphertext
|
|
3371
|
+
* Wrapped division.
|
|
2115
3372
|
*/
|
|
2116
|
-
|
|
3373
|
+
divWrapped(other: U128): U128;
|
|
2117
3374
|
/**
|
|
2118
|
-
*
|
|
2119
|
-
*
|
|
2120
|
-
* @returns {string} String representation of the record ciphertext
|
|
3375
|
+
* Power to a u8 exponent.
|
|
2121
3376
|
*/
|
|
2122
|
-
|
|
3377
|
+
powU8(exponent: U8): U128;
|
|
2123
3378
|
/**
|
|
2124
|
-
*
|
|
2125
|
-
* decrypt if the record was encrypted by the account corresponding to the view key
|
|
2126
|
-
*
|
|
2127
|
-
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
2128
|
-
* @returns {RecordPlaintext} Record plaintext object
|
|
3379
|
+
* Power to a u16 exponent.
|
|
2129
3380
|
*/
|
|
2130
|
-
|
|
3381
|
+
powU16(exponent: U16): U128;
|
|
2131
3382
|
/**
|
|
2132
|
-
*
|
|
2133
|
-
* supplied view key belongs to the record owner.
|
|
2134
|
-
*
|
|
2135
|
-
* @param {ViewKey} view_key View key used to generate the record view key
|
|
2136
|
-
*
|
|
2137
|
-
* @returns {Group} record view key
|
|
3383
|
+
* Power to a u32 exponent.
|
|
2138
3384
|
*/
|
|
2139
|
-
|
|
3385
|
+
powU32(exponent: U32): U128;
|
|
2140
3386
|
/**
|
|
2141
|
-
*
|
|
2142
|
-
*
|
|
2143
|
-
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
2144
|
-
* @returns {boolean}
|
|
3387
|
+
* Negates the integer (e.g., 5 → -5).
|
|
2145
3388
|
*/
|
|
2146
|
-
|
|
3389
|
+
neg(): U128;
|
|
2147
3390
|
/**
|
|
2148
|
-
*
|
|
2149
|
-
*
|
|
2150
|
-
* @param {GraphKey} graph key of the account associatd with the record.
|
|
2151
|
-
* @param {Field} commitment of the record.
|
|
2152
|
-
*
|
|
2153
|
-
* @returns {Field} tag of the record.
|
|
3391
|
+
* Checks equality with another integer.
|
|
2154
3392
|
*/
|
|
2155
|
-
|
|
3393
|
+
equals(other: U128): boolean;
|
|
2156
3394
|
/**
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2159
|
-
* @param {Uint8Array} bytes A left endian byte array representing the record ciphertext.
|
|
2160
|
-
*
|
|
2161
|
-
* @returns {RecordCiphertext}
|
|
3395
|
+
* Remainder.
|
|
2162
3396
|
*/
|
|
2163
|
-
|
|
3397
|
+
rem(other: U128): U128;
|
|
2164
3398
|
/**
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2167
|
-
* @returns {Uint8Array} Left endian byte array representation of the record ciphertext.
|
|
3399
|
+
* Wrapped remainder.
|
|
2168
3400
|
*/
|
|
2169
|
-
|
|
3401
|
+
remWrapped(other: U128): U128;
|
|
2170
3402
|
/**
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2173
|
-
* returns {Array} Left endian boolean array representation of the bits of the record ciphertext.
|
|
3403
|
+
* Convert to Scalar.
|
|
2174
3404
|
*/
|
|
2175
|
-
|
|
3405
|
+
toScalar(): Scalar;
|
|
2176
3406
|
/**
|
|
2177
|
-
*
|
|
2178
|
-
*
|
|
2179
|
-
* @returns {Array} Field array representation of the record ciphertext.
|
|
3407
|
+
* Convert to plaintext.
|
|
2180
3408
|
*/
|
|
2181
|
-
|
|
3409
|
+
toPlaintext(): Plaintext;
|
|
2182
3410
|
/**
|
|
2183
|
-
*
|
|
2184
|
-
*
|
|
2185
|
-
* @param {Field} record_vk Record view key used to decrypt the record.
|
|
2186
|
-
*
|
|
2187
|
-
* @returns {RecordPlaintext}
|
|
3411
|
+
* Convert from Field.
|
|
2188
3412
|
*/
|
|
2189
|
-
|
|
3413
|
+
static fromField(field: Field): U128;
|
|
2190
3414
|
/**
|
|
2191
|
-
*
|
|
2192
|
-
*
|
|
2193
|
-
* @returns {Group} The record nonce.
|
|
3415
|
+
* Convert from Fields.
|
|
2194
3416
|
*/
|
|
2195
|
-
|
|
3417
|
+
static fromFields(fields: Array<any>): U128;
|
|
3418
|
+
/**
|
|
3419
|
+
* Clone.
|
|
3420
|
+
*/
|
|
3421
|
+
clone(): U128;
|
|
2196
3422
|
}
|
|
2197
|
-
|
|
2198
|
-
* Plaintext representation of an Aleo record
|
|
2199
|
-
*/
|
|
2200
|
-
export class RecordPlaintext {
|
|
3423
|
+
export class U16 {
|
|
2201
3424
|
private constructor();
|
|
2202
3425
|
free(): void;
|
|
2203
|
-
commitment(program_id: string, record_name: string, record_view_key: string): Field;
|
|
2204
3426
|
/**
|
|
2205
|
-
*
|
|
2206
|
-
*
|
|
2207
|
-
* @param {string} record String representation of a plaintext representation of an Aleo record.
|
|
2208
|
-
*
|
|
2209
|
-
* @returns {RecordPlaintext} Record plaintext
|
|
3427
|
+
* Creates from string.
|
|
2210
3428
|
*/
|
|
2211
|
-
static fromString(
|
|
3429
|
+
static fromString(s: string): U16;
|
|
2212
3430
|
/**
|
|
2213
|
-
*
|
|
2214
|
-
*
|
|
2215
|
-
* @param {string} input The key to retrieve the value in the record data field.
|
|
2216
|
-
*
|
|
2217
|
-
* @returns {Plaintext} The plaintext value corresponding to the key.
|
|
3431
|
+
* To string.
|
|
2218
3432
|
*/
|
|
2219
|
-
|
|
3433
|
+
toString(): string;
|
|
2220
3434
|
/**
|
|
2221
|
-
*
|
|
2222
|
-
*
|
|
2223
|
-
* @returns {Address} Address of the owner of the record.
|
|
3435
|
+
* From bytes (LE).
|
|
2224
3436
|
*/
|
|
2225
|
-
|
|
3437
|
+
static fromBytesLe(bytes: Uint8Array): U16;
|
|
2226
3438
|
/**
|
|
2227
|
-
*
|
|
2228
|
-
* computations. Note that this is not a reversible operation and exists for the convenience
|
|
2229
|
-
* of discovering and using properties of the record.
|
|
2230
|
-
*
|
|
2231
|
-
* The conversion guide is as follows:
|
|
2232
|
-
* - u8, u16, u32, i8, i16 i32 --> Number
|
|
2233
|
-
* - u64, u128, i64, i128 --> BigInt
|
|
2234
|
-
* - Address, Field, Group, Scalar --> String.
|
|
2235
|
-
*
|
|
2236
|
-
* Address, Field, Group, and Scalar will all be converted to their bech32 string
|
|
2237
|
-
* representation. These string representations can be converted back to their respective wasm
|
|
2238
|
-
* types using the fromString method on the Address, Field, Group, and Scalar objects in this
|
|
2239
|
-
* library.
|
|
2240
|
-
*
|
|
2241
|
-
* @example
|
|
2242
|
-
* # Create a wasm record from a record string.
|
|
2243
|
-
* let record_plaintext_wasm = RecordPlainext.from_string("{
|
|
2244
|
-
* owner: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
2245
|
-
* metadata: {
|
|
2246
|
-
* player1: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
2247
|
-
* player2: aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6.private,
|
|
2248
|
-
* nonce: 660310649780728486489183263981322848354071976582883879926426319832534836534field.private
|
|
2249
|
-
* },
|
|
2250
|
-
* id: 1953278585719525811355617404139099418855053112960441725284031425961000152405field.private,
|
|
2251
|
-
* positions: 50794271u64.private,
|
|
2252
|
-
* attempts: 0u64.private,
|
|
2253
|
-
* hits: 0u64.private,
|
|
2254
|
-
* _nonce: 5668100912391182624073500093436664635767788874314097667746354181784048204413group.public
|
|
2255
|
-
* }");
|
|
2256
|
-
*
|
|
2257
|
-
* let expected_object = {
|
|
2258
|
-
* owner: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
2259
|
-
* metadata: {
|
|
2260
|
-
* player1: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
2261
|
-
* player2: "aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6",
|
|
2262
|
-
* nonce: "660310649780728486489183263981322848354071976582883879926426319832534836534field"
|
|
2263
|
-
* },
|
|
2264
|
-
* id: "1953278585719525811355617404139099418855053112960441725284031425961000152405field",
|
|
2265
|
-
* positions: 50794271,
|
|
2266
|
-
* attempts: 0,
|
|
2267
|
-
* hits: 0,
|
|
2268
|
-
* _nonce: "5668100912391182624073500093436664635767788874314097667746354181784048204413group"
|
|
2269
|
-
* };
|
|
2270
|
-
*
|
|
2271
|
-
* # Create the expected object
|
|
2272
|
-
* let record_plaintext_object = record_plaintext_wasm.to_js_object();
|
|
2273
|
-
* assert(JSON.stringify(record_plaintext_object) == JSON.stringify(expected_object));
|
|
2274
|
-
*
|
|
2275
|
-
* @returns {Object} Javascript object representation of the record
|
|
3439
|
+
* To bytes (LE).
|
|
2276
3440
|
*/
|
|
2277
|
-
|
|
3441
|
+
toBytesLe(): Uint8Array;
|
|
2278
3442
|
/**
|
|
2279
|
-
*
|
|
2280
|
-
*
|
|
2281
|
-
* @returns {string} String representation of the record plaintext
|
|
3443
|
+
* From bits.
|
|
2282
3444
|
*/
|
|
2283
|
-
|
|
3445
|
+
static fromBitsLe(bits: Array<any>): U16;
|
|
2284
3446
|
/**
|
|
2285
|
-
*
|
|
2286
|
-
*
|
|
2287
|
-
* @param {Uint8Array} bytes A left endian byte array representing the record plaintext.
|
|
2288
|
-
*
|
|
2289
|
-
* @returns {RecordPlaintext} The record plaintext.
|
|
3447
|
+
* To bits.
|
|
2290
3448
|
*/
|
|
2291
|
-
|
|
3449
|
+
toBitsLe(): Array<any>;
|
|
2292
3450
|
/**
|
|
2293
|
-
*
|
|
2294
|
-
*
|
|
2295
|
-
* @returns {Uint8Array} Byte array representation of the record plaintext.
|
|
3451
|
+
* Checked absolute value.
|
|
2296
3452
|
*/
|
|
2297
|
-
|
|
3453
|
+
absChecked(): U16;
|
|
2298
3454
|
/**
|
|
2299
|
-
*
|
|
2300
|
-
*
|
|
2301
|
-
* @returns {Array} Boolean array representation of the record plaintext bits.
|
|
3455
|
+
* Wrapped absolute value.
|
|
2302
3456
|
*/
|
|
2303
|
-
|
|
3457
|
+
absWrapped(): U16;
|
|
2304
3458
|
/**
|
|
2305
|
-
*
|
|
3459
|
+
* Wrapped addition.
|
|
2306
3460
|
*/
|
|
2307
|
-
|
|
3461
|
+
addWrapped(other: U16): U16;
|
|
2308
3462
|
/**
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2311
|
-
* @returns {u64} Amount of microcredits in the record
|
|
3463
|
+
* Wrapped subtraction.
|
|
2312
3464
|
*/
|
|
2313
|
-
|
|
3465
|
+
subWrapped(other: U16): U16;
|
|
2314
3466
|
/**
|
|
2315
|
-
*
|
|
2316
|
-
*
|
|
2317
|
-
* @returns {string} Nonce of the record
|
|
3467
|
+
* Wrapped multiplication.
|
|
2318
3468
|
*/
|
|
2319
|
-
|
|
3469
|
+
mulWrapped(other: U16): U16;
|
|
2320
3470
|
/**
|
|
2321
|
-
*
|
|
2322
|
-
*
|
|
2323
|
-
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
2324
|
-
* @param {string} program_id Program ID of the program that the record is associated with
|
|
2325
|
-
* @param {string} record_name Name of the record
|
|
2326
|
-
* @param {string} record_view_key The string representation of the record view key.
|
|
2327
|
-
*
|
|
2328
|
-
* @returns {string} Serial number of the record
|
|
3471
|
+
* Wrapped division.
|
|
2329
3472
|
*/
|
|
2330
|
-
|
|
3473
|
+
divWrapped(other: U16): U16;
|
|
2331
3474
|
/**
|
|
2332
|
-
*
|
|
3475
|
+
* Power to a u8 exponent.
|
|
2333
3476
|
*/
|
|
2334
|
-
|
|
3477
|
+
powU8(exponent: U8): U16;
|
|
2335
3478
|
/**
|
|
2336
|
-
*
|
|
2337
|
-
* supplied view key belongs to the record owner.
|
|
2338
|
-
*
|
|
2339
|
-
* @param {ViewKey} view_key View key used to generate the record view key
|
|
2340
|
-
*
|
|
2341
|
-
* @returns {Group} record view key
|
|
3479
|
+
* Power to a u16 exponent.
|
|
2342
3480
|
*/
|
|
2343
|
-
|
|
2344
|
-
}
|
|
2345
|
-
/**
|
|
2346
|
-
* Scalar field element.
|
|
2347
|
-
*/
|
|
2348
|
-
export class Scalar {
|
|
2349
|
-
private constructor();
|
|
2350
|
-
free(): void;
|
|
3481
|
+
powU16(exponent: U16): U16;
|
|
2351
3482
|
/**
|
|
2352
|
-
*
|
|
3483
|
+
* Power to a u32 exponent.
|
|
2353
3484
|
*/
|
|
2354
|
-
|
|
3485
|
+
powU32(exponent: U32): U16;
|
|
2355
3486
|
/**
|
|
2356
|
-
*
|
|
3487
|
+
* Negates the integer (e.g., 5 → -5).
|
|
2357
3488
|
*/
|
|
2358
|
-
|
|
3489
|
+
neg(): U16;
|
|
2359
3490
|
/**
|
|
2360
|
-
*
|
|
3491
|
+
* Checks equality with another integer.
|
|
2361
3492
|
*/
|
|
2362
|
-
|
|
3493
|
+
equals(other: U16): boolean;
|
|
2363
3494
|
/**
|
|
2364
|
-
*
|
|
3495
|
+
* Remainder.
|
|
2365
3496
|
*/
|
|
2366
|
-
|
|
3497
|
+
rem(other: U16): U16;
|
|
2367
3498
|
/**
|
|
2368
|
-
*
|
|
3499
|
+
* Wrapped remainder.
|
|
2369
3500
|
*/
|
|
2370
|
-
|
|
3501
|
+
remWrapped(other: U16): U16;
|
|
2371
3502
|
/**
|
|
2372
|
-
*
|
|
3503
|
+
* Convert to Scalar.
|
|
2373
3504
|
*/
|
|
2374
|
-
|
|
3505
|
+
toScalar(): Scalar;
|
|
2375
3506
|
/**
|
|
2376
|
-
*
|
|
3507
|
+
* Convert to plaintext.
|
|
2377
3508
|
*/
|
|
2378
3509
|
toPlaintext(): Plaintext;
|
|
2379
3510
|
/**
|
|
2380
|
-
*
|
|
3511
|
+
* Convert from Field.
|
|
2381
3512
|
*/
|
|
2382
|
-
|
|
3513
|
+
static fromField(field: Field): U16;
|
|
2383
3514
|
/**
|
|
2384
|
-
*
|
|
3515
|
+
* Convert from Fields.
|
|
2385
3516
|
*/
|
|
2386
|
-
static
|
|
3517
|
+
static fromFields(fields: Array<any>): U16;
|
|
2387
3518
|
/**
|
|
2388
|
-
*
|
|
3519
|
+
* Clone.
|
|
2389
3520
|
*/
|
|
2390
|
-
|
|
3521
|
+
clone(): U16;
|
|
3522
|
+
}
|
|
3523
|
+
export class U32 {
|
|
3524
|
+
private constructor();
|
|
3525
|
+
free(): void;
|
|
2391
3526
|
/**
|
|
2392
|
-
*
|
|
3527
|
+
* Creates from string.
|
|
2393
3528
|
*/
|
|
2394
|
-
|
|
3529
|
+
static fromString(s: string): U32;
|
|
2395
3530
|
/**
|
|
2396
|
-
*
|
|
3531
|
+
* To string.
|
|
2397
3532
|
*/
|
|
2398
|
-
|
|
3533
|
+
toString(): string;
|
|
2399
3534
|
/**
|
|
2400
|
-
*
|
|
3535
|
+
* From bytes (LE).
|
|
2401
3536
|
*/
|
|
2402
|
-
|
|
3537
|
+
static fromBytesLe(bytes: Uint8Array): U32;
|
|
2403
3538
|
/**
|
|
2404
|
-
*
|
|
3539
|
+
* To bytes (LE).
|
|
2405
3540
|
*/
|
|
2406
|
-
|
|
3541
|
+
toBytesLe(): Uint8Array;
|
|
2407
3542
|
/**
|
|
2408
|
-
*
|
|
3543
|
+
* From bits.
|
|
2409
3544
|
*/
|
|
2410
|
-
|
|
3545
|
+
static fromBitsLe(bits: Array<any>): U32;
|
|
2411
3546
|
/**
|
|
2412
|
-
*
|
|
3547
|
+
* To bits.
|
|
2413
3548
|
*/
|
|
2414
|
-
|
|
3549
|
+
toBitsLe(): Array<any>;
|
|
2415
3550
|
/**
|
|
2416
|
-
*
|
|
3551
|
+
* Checked absolute value.
|
|
2417
3552
|
*/
|
|
2418
|
-
|
|
3553
|
+
absChecked(): U32;
|
|
2419
3554
|
/**
|
|
2420
|
-
*
|
|
3555
|
+
* Wrapped absolute value.
|
|
2421
3556
|
*/
|
|
2422
|
-
|
|
3557
|
+
absWrapped(): U32;
|
|
2423
3558
|
/**
|
|
2424
|
-
*
|
|
3559
|
+
* Wrapped addition.
|
|
2425
3560
|
*/
|
|
2426
|
-
|
|
2427
|
-
}
|
|
2428
|
-
/**
|
|
2429
|
-
* Cryptographic signature of a message signed by an Aleo account
|
|
2430
|
-
*/
|
|
2431
|
-
export class Signature {
|
|
2432
|
-
private constructor();
|
|
2433
|
-
free(): void;
|
|
3561
|
+
addWrapped(other: U32): U32;
|
|
2434
3562
|
/**
|
|
2435
|
-
*
|
|
2436
|
-
*
|
|
2437
|
-
* @param {PrivateKey} private_key The private key to sign the message with
|
|
2438
|
-
* @param {Uint8Array} message Byte representation of the message to sign
|
|
2439
|
-
* @returns {Signature} Signature of the message
|
|
3563
|
+
* Wrapped subtraction.
|
|
2440
3564
|
*/
|
|
2441
|
-
|
|
3565
|
+
subWrapped(other: U32): U32;
|
|
2442
3566
|
/**
|
|
2443
|
-
*
|
|
2444
|
-
*
|
|
2445
|
-
* @returns {Address} Address object
|
|
3567
|
+
* Wrapped multiplication.
|
|
2446
3568
|
*/
|
|
2447
|
-
|
|
3569
|
+
mulWrapped(other: U32): U32;
|
|
3570
|
+
/**
|
|
3571
|
+
* Wrapped division.
|
|
3572
|
+
*/
|
|
3573
|
+
divWrapped(other: U32): U32;
|
|
3574
|
+
/**
|
|
3575
|
+
* Power to a u8 exponent.
|
|
3576
|
+
*/
|
|
3577
|
+
powU8(exponent: U8): U32;
|
|
2448
3578
|
/**
|
|
2449
|
-
*
|
|
3579
|
+
* Power to a u16 exponent.
|
|
2450
3580
|
*/
|
|
2451
|
-
|
|
3581
|
+
powU16(exponent: U16): U32;
|
|
2452
3582
|
/**
|
|
2453
|
-
*
|
|
3583
|
+
* Power to a u32 exponent.
|
|
2454
3584
|
*/
|
|
2455
|
-
|
|
3585
|
+
powU32(exponent: U32): U32;
|
|
2456
3586
|
/**
|
|
2457
|
-
*
|
|
2458
|
-
*
|
|
2459
|
-
* @param {Address} address The address to verify the signature with
|
|
2460
|
-
* @param {Uint8Array} message Byte representation of the message to verify
|
|
2461
|
-
* @returns {boolean} True if the signature is valid, false otherwise
|
|
3587
|
+
* Negates the integer (e.g., 5 → -5).
|
|
2462
3588
|
*/
|
|
2463
|
-
|
|
3589
|
+
neg(): U32;
|
|
2464
3590
|
/**
|
|
2465
|
-
*
|
|
2466
|
-
*
|
|
2467
|
-
* @param {Uint8Array} bytes A left endian byte array representing the signature.
|
|
2468
|
-
*
|
|
2469
|
-
* @returns {Signature} The signature object.
|
|
3591
|
+
* Checks equality with another integer.
|
|
2470
3592
|
*/
|
|
2471
|
-
|
|
3593
|
+
equals(other: U32): boolean;
|
|
2472
3594
|
/**
|
|
2473
|
-
*
|
|
3595
|
+
* Remainder.
|
|
2474
3596
|
*/
|
|
2475
|
-
|
|
3597
|
+
rem(other: U32): U32;
|
|
2476
3598
|
/**
|
|
2477
|
-
*
|
|
2478
|
-
*
|
|
2479
|
-
* @param {Array} bits A left endian boolean array representing the bits of the signature.
|
|
2480
|
-
*
|
|
2481
|
-
* @returns {Signature} The signature object.
|
|
3599
|
+
* Wrapped remainder.
|
|
2482
3600
|
*/
|
|
2483
|
-
|
|
3601
|
+
remWrapped(other: U32): U32;
|
|
2484
3602
|
/**
|
|
2485
|
-
*
|
|
3603
|
+
* Convert to Scalar.
|
|
2486
3604
|
*/
|
|
2487
|
-
|
|
3605
|
+
toScalar(): Scalar;
|
|
2488
3606
|
/**
|
|
2489
|
-
*
|
|
3607
|
+
* Convert to plaintext.
|
|
2490
3608
|
*/
|
|
2491
|
-
|
|
3609
|
+
toPlaintext(): Plaintext;
|
|
2492
3610
|
/**
|
|
2493
|
-
*
|
|
2494
|
-
*
|
|
2495
|
-
* @param {string} signature String representation of a signature
|
|
2496
|
-
* @returns {Signature} Signature
|
|
3611
|
+
* Convert from Field.
|
|
2497
3612
|
*/
|
|
2498
|
-
static
|
|
3613
|
+
static fromField(field: Field): U32;
|
|
2499
3614
|
/**
|
|
2500
|
-
*
|
|
2501
|
-
*
|
|
2502
|
-
* @returns {string} String representation of a signature
|
|
3615
|
+
* Convert from Fields.
|
|
2503
3616
|
*/
|
|
2504
|
-
|
|
3617
|
+
static fromFields(fields: Array<any>): U32;
|
|
2505
3618
|
/**
|
|
2506
|
-
*
|
|
3619
|
+
* Clone.
|
|
2507
3620
|
*/
|
|
2508
|
-
|
|
3621
|
+
clone(): U32;
|
|
2509
3622
|
}
|
|
2510
|
-
|
|
2511
|
-
* Webassembly Representation of an Aleo transaction
|
|
2512
|
-
*
|
|
2513
|
-
* This object is created when generating an on-chain function deployment or execution and is the
|
|
2514
|
-
* object that should be submitted to the Aleo Network in order to deploy or execute a function.
|
|
2515
|
-
*/
|
|
2516
|
-
export class Transaction {
|
|
3623
|
+
export class U64 {
|
|
2517
3624
|
private constructor();
|
|
2518
3625
|
free(): void;
|
|
2519
3626
|
/**
|
|
2520
|
-
*
|
|
2521
|
-
*
|
|
2522
|
-
* @param {string} transaction String representation of a transaction
|
|
2523
|
-
* @returns {Transaction}
|
|
3627
|
+
* Creates from string.
|
|
2524
3628
|
*/
|
|
2525
|
-
static fromString(
|
|
3629
|
+
static fromString(s: string): U64;
|
|
2526
3630
|
/**
|
|
2527
|
-
*
|
|
2528
|
-
*
|
|
2529
|
-
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transaction.
|
|
2530
|
-
* @returns {Transaction}
|
|
3631
|
+
* To string.
|
|
2531
3632
|
*/
|
|
2532
|
-
|
|
3633
|
+
toString(): string;
|
|
2533
3634
|
/**
|
|
2534
|
-
*
|
|
2535
|
-
* this function will create the string that should be submitted in the `POST` data.
|
|
2536
|
-
*
|
|
2537
|
-
* @returns {string} String representation of the transaction
|
|
3635
|
+
* From bytes (LE).
|
|
2538
3636
|
*/
|
|
2539
|
-
|
|
3637
|
+
static fromBytesLe(bytes: Uint8Array): U64;
|
|
2540
3638
|
/**
|
|
2541
|
-
*
|
|
2542
|
-
*
|
|
2543
|
-
* @returns {Uint8Array} Uint8Array representation of the transaction
|
|
3639
|
+
* To bytes (LE).
|
|
2544
3640
|
*/
|
|
2545
3641
|
toBytesLe(): Uint8Array;
|
|
2546
3642
|
/**
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2549
|
-
* @param {boolean} True if the transaction contains the given serial number.
|
|
3643
|
+
* From bits.
|
|
2550
3644
|
*/
|
|
2551
|
-
|
|
3645
|
+
static fromBitsLe(bits: Array<any>): U64;
|
|
2552
3646
|
/**
|
|
2553
|
-
*
|
|
2554
|
-
*
|
|
2555
|
-
* @param {boolean} True if the transaction contains the given commitment.
|
|
3647
|
+
* To bits.
|
|
2556
3648
|
*/
|
|
2557
|
-
|
|
3649
|
+
toBitsLe(): Array<any>;
|
|
2558
3650
|
/**
|
|
2559
|
-
*
|
|
3651
|
+
* Checked absolute value.
|
|
2560
3652
|
*/
|
|
2561
|
-
|
|
3653
|
+
absChecked(): U64;
|
|
2562
3654
|
/**
|
|
2563
|
-
*
|
|
3655
|
+
* Wrapped absolute value.
|
|
2564
3656
|
*/
|
|
2565
|
-
|
|
3657
|
+
absWrapped(): U64;
|
|
2566
3658
|
/**
|
|
2567
|
-
*
|
|
3659
|
+
* Wrapped addition.
|
|
2568
3660
|
*/
|
|
2569
|
-
|
|
3661
|
+
addWrapped(other: U64): U64;
|
|
2570
3662
|
/**
|
|
2571
|
-
*
|
|
2572
|
-
*
|
|
2573
|
-
* returns {bigint} The transaction's priority fee.
|
|
3663
|
+
* Wrapped subtraction.
|
|
2574
3664
|
*/
|
|
2575
|
-
|
|
3665
|
+
subWrapped(other: U64): U64;
|
|
2576
3666
|
/**
|
|
2577
|
-
*
|
|
2578
|
-
*
|
|
2579
|
-
* @returns {boolean} True if the transaction is a deployment transaction
|
|
3667
|
+
* Wrapped multiplication.
|
|
2580
3668
|
*/
|
|
2581
|
-
|
|
3669
|
+
mulWrapped(other: U64): U64;
|
|
2582
3670
|
/**
|
|
2583
|
-
*
|
|
2584
|
-
*
|
|
2585
|
-
* @returns {boolean} True if the transaction is an execution transaction
|
|
3671
|
+
* Wrapped division.
|
|
2586
3672
|
*/
|
|
2587
|
-
|
|
3673
|
+
divWrapped(other: U64): U64;
|
|
2588
3674
|
/**
|
|
2589
|
-
*
|
|
2590
|
-
*
|
|
2591
|
-
* @returns {boolean} True if the transaction is a fee transaction
|
|
3675
|
+
* Power to a u8 exponent.
|
|
2592
3676
|
*/
|
|
2593
|
-
|
|
3677
|
+
powU8(exponent: U8): U64;
|
|
2594
3678
|
/**
|
|
2595
|
-
*
|
|
2596
|
-
* transaction.
|
|
2597
|
-
*
|
|
2598
|
-
* @returns {Program | undefined} The program deployed within the transaction.
|
|
3679
|
+
* Power to a u16 exponent.
|
|
2599
3680
|
*/
|
|
2600
|
-
|
|
3681
|
+
powU16(exponent: U16): U64;
|
|
2601
3682
|
/**
|
|
2602
|
-
*
|
|
2603
|
-
*
|
|
2604
|
-
* @returns {Execution | undefined} The execution within the transaction.
|
|
3683
|
+
* Power to a u32 exponent.
|
|
2605
3684
|
*/
|
|
2606
|
-
|
|
3685
|
+
powU32(exponent: U32): U64;
|
|
2607
3686
|
/**
|
|
2608
|
-
*
|
|
2609
|
-
*
|
|
2610
|
-
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
2611
|
-
*
|
|
2612
|
-
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
3687
|
+
* Negates the integer (e.g., 5 → -5).
|
|
2613
3688
|
*/
|
|
2614
|
-
|
|
3689
|
+
neg(): U64;
|
|
2615
3690
|
/**
|
|
2616
|
-
*
|
|
2617
|
-
*
|
|
2618
|
-
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
3691
|
+
* Checks equality with another integer.
|
|
2619
3692
|
*/
|
|
2620
|
-
|
|
3693
|
+
equals(other: U64): boolean;
|
|
2621
3694
|
/**
|
|
2622
|
-
*
|
|
2623
|
-
*
|
|
2624
|
-
* If the transaction is an execution transaction, this function will return a list of the
|
|
2625
|
-
* transitions and their inputs and outputs.
|
|
2626
|
-
*
|
|
2627
|
-
* If the transaction is a deployment transaction, this function will return the program id and
|
|
2628
|
-
* a list of the functions and their verifying keys, constraint, and variable counts.
|
|
2629
|
-
*
|
|
2630
|
-
* @param {boolean} convert_to_js If true the inputs and outputs will be converted to JS objects,
|
|
2631
|
-
* if false the inputs and outputs will be in wasm format.
|
|
2632
|
-
*
|
|
2633
|
-
* @returns {Object} Transaction summary
|
|
3695
|
+
* Remainder.
|
|
2634
3696
|
*/
|
|
2635
|
-
|
|
3697
|
+
rem(other: U64): U64;
|
|
2636
3698
|
/**
|
|
2637
|
-
*
|
|
2638
|
-
*
|
|
2639
|
-
* This value can be used to query the status of the transaction on the Aleo Network to see
|
|
2640
|
-
* if it was successful. If successful, the transaction will be included in a block and this
|
|
2641
|
-
* value can be used to lookup the transaction data on-chain.
|
|
2642
|
-
*
|
|
2643
|
-
* @returns {string} TransactionId
|
|
3699
|
+
* Wrapped remainder.
|
|
2644
3700
|
*/
|
|
2645
|
-
|
|
3701
|
+
remWrapped(other: U64): U64;
|
|
2646
3702
|
/**
|
|
2647
|
-
*
|
|
2648
|
-
*
|
|
2649
|
-
* @returns {string} Transaction type
|
|
3703
|
+
* Convert to Scalar.
|
|
2650
3704
|
*/
|
|
2651
|
-
|
|
3705
|
+
toScalar(): Scalar;
|
|
2652
3706
|
/**
|
|
2653
|
-
*
|
|
2654
|
-
*
|
|
2655
|
-
* @returns {Array<Transition>} Array of transition objects
|
|
3707
|
+
* Convert to plaintext.
|
|
2656
3708
|
*/
|
|
2657
|
-
|
|
3709
|
+
toPlaintext(): Plaintext;
|
|
2658
3710
|
/**
|
|
2659
|
-
*
|
|
2660
|
-
*
|
|
2661
|
-
* @returns {Array<Object>} Array of verifying keys.
|
|
3711
|
+
* Convert from Field.
|
|
2662
3712
|
*/
|
|
2663
|
-
|
|
3713
|
+
static fromField(field: Field): U64;
|
|
3714
|
+
/**
|
|
3715
|
+
* Convert from Fields.
|
|
3716
|
+
*/
|
|
3717
|
+
static fromFields(fields: Array<any>): U64;
|
|
3718
|
+
/**
|
|
3719
|
+
* Clone.
|
|
3720
|
+
*/
|
|
3721
|
+
clone(): U64;
|
|
2664
3722
|
}
|
|
2665
|
-
export class
|
|
3723
|
+
export class U8 {
|
|
2666
3724
|
private constructor();
|
|
2667
3725
|
free(): void;
|
|
2668
3726
|
/**
|
|
2669
|
-
*
|
|
2670
|
-
*
|
|
2671
|
-
* @returns {string} The transition ID
|
|
3727
|
+
* Creates from string.
|
|
2672
3728
|
*/
|
|
2673
|
-
|
|
3729
|
+
static fromString(s: string): U8;
|
|
2674
3730
|
/**
|
|
2675
|
-
*
|
|
2676
|
-
*
|
|
2677
|
-
* @param {string} transition String representation of a transition
|
|
2678
|
-
* @returns {Transition}
|
|
3731
|
+
* To string.
|
|
2679
3732
|
*/
|
|
2680
|
-
|
|
3733
|
+
toString(): string;
|
|
2681
3734
|
/**
|
|
2682
|
-
*
|
|
2683
|
-
*
|
|
2684
|
-
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transition.
|
|
2685
|
-
* @returns {Transition}
|
|
3735
|
+
* From bytes (LE).
|
|
2686
3736
|
*/
|
|
2687
|
-
static fromBytesLe(bytes: Uint8Array):
|
|
3737
|
+
static fromBytesLe(bytes: Uint8Array): U8;
|
|
2688
3738
|
/**
|
|
2689
|
-
*
|
|
2690
|
-
* this function will create the string that should be submitted in the `POST` data.
|
|
2691
|
-
*
|
|
2692
|
-
* @returns {string} String representation of the transition
|
|
3739
|
+
* To bytes (LE).
|
|
2693
3740
|
*/
|
|
2694
|
-
|
|
3741
|
+
toBytesLe(): Uint8Array;
|
|
2695
3742
|
/**
|
|
2696
|
-
*
|
|
2697
|
-
*
|
|
2698
|
-
* @returns {Uint8Array} Uint8Array representation of the transition
|
|
3743
|
+
* From bits.
|
|
2699
3744
|
*/
|
|
2700
|
-
|
|
3745
|
+
static fromBitsLe(bits: Array<any>): U8;
|
|
2701
3746
|
/**
|
|
2702
|
-
*
|
|
3747
|
+
* To bits.
|
|
2703
3748
|
*/
|
|
2704
|
-
|
|
3749
|
+
toBitsLe(): Array<any>;
|
|
2705
3750
|
/**
|
|
2706
|
-
*
|
|
3751
|
+
* Checked absolute value.
|
|
2707
3752
|
*/
|
|
2708
|
-
|
|
3753
|
+
absChecked(): U8;
|
|
2709
3754
|
/**
|
|
2710
|
-
*
|
|
2711
|
-
*
|
|
2712
|
-
* @param {boolean} True if the transition contains the given commitment.
|
|
3755
|
+
* Wrapped absolute value.
|
|
2713
3756
|
*/
|
|
2714
|
-
|
|
3757
|
+
absWrapped(): U8;
|
|
2715
3758
|
/**
|
|
2716
|
-
*
|
|
2717
|
-
*
|
|
2718
|
-
* @param {Field} serial_number The serial number to check for
|
|
2719
|
-
*
|
|
2720
|
-
* @returns {bool} True if the transition contains a serial number, false otherwise
|
|
3759
|
+
* Wrapped addition.
|
|
2721
3760
|
*/
|
|
2722
|
-
|
|
3761
|
+
addWrapped(other: U8): U8;
|
|
2723
3762
|
/**
|
|
2724
|
-
*
|
|
3763
|
+
* Wrapped subtraction.
|
|
2725
3764
|
*/
|
|
2726
|
-
|
|
3765
|
+
subWrapped(other: U8): U8;
|
|
2727
3766
|
/**
|
|
2728
|
-
*
|
|
2729
|
-
*
|
|
2730
|
-
* @param {ViewKey} view_key The view key of the record owner.
|
|
2731
|
-
*
|
|
2732
|
-
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
3767
|
+
* Wrapped multiplication.
|
|
2733
3768
|
*/
|
|
2734
|
-
|
|
3769
|
+
mulWrapped(other: U8): U8;
|
|
2735
3770
|
/**
|
|
2736
|
-
*
|
|
2737
|
-
*
|
|
2738
|
-
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
3771
|
+
* Wrapped division.
|
|
2739
3772
|
*/
|
|
2740
|
-
|
|
3773
|
+
divWrapped(other: U8): U8;
|
|
2741
3774
|
/**
|
|
2742
|
-
*
|
|
2743
|
-
*
|
|
2744
|
-
* @param {bool} convert_to_js If true the inputs will be converted to JS objects, if false
|
|
2745
|
-
* the inputs will be in wasm format.
|
|
2746
|
-
*
|
|
2747
|
-
* @returns {Array} Array of inputs
|
|
3775
|
+
* Power to a u8 exponent.
|
|
2748
3776
|
*/
|
|
2749
|
-
|
|
3777
|
+
powU8(exponent: U8): U8;
|
|
2750
3778
|
/**
|
|
2751
|
-
*
|
|
2752
|
-
*
|
|
2753
|
-
* @param {bool} convert_to_js If true the outputs will be converted to JS objects, if false
|
|
2754
|
-
* the outputs will be in wasm format.
|
|
2755
|
-
*
|
|
2756
|
-
* @returns {Array} Array of outputs
|
|
3779
|
+
* Power to a u16 exponent.
|
|
2757
3780
|
*/
|
|
2758
|
-
|
|
3781
|
+
powU16(exponent: U16): U8;
|
|
2759
3782
|
/**
|
|
2760
|
-
*
|
|
2761
|
-
*
|
|
2762
|
-
* @returns {Group} Transition public key
|
|
3783
|
+
* Power to a u32 exponent.
|
|
2763
3784
|
*/
|
|
2764
|
-
|
|
3785
|
+
powU32(exponent: U32): U8;
|
|
2765
3786
|
/**
|
|
2766
|
-
*
|
|
2767
|
-
*
|
|
2768
|
-
* @param {ViewKey} view_key The view key of the transition signer.
|
|
2769
|
-
*
|
|
2770
|
-
* @returns {Field} Transition view key
|
|
3787
|
+
* Negates the integer (e.g., 5 → -5).
|
|
2771
3788
|
*/
|
|
2772
|
-
|
|
3789
|
+
neg(): U8;
|
|
2773
3790
|
/**
|
|
2774
|
-
*
|
|
2775
|
-
*
|
|
2776
|
-
* @returns {Field} Transition commitment
|
|
3791
|
+
* Checks equality with another integer.
|
|
2777
3792
|
*/
|
|
2778
|
-
|
|
3793
|
+
equals(other: U8): boolean;
|
|
2779
3794
|
/**
|
|
2780
|
-
*
|
|
2781
|
-
*
|
|
2782
|
-
* @returns {Field} Transition signer commitment
|
|
3795
|
+
* Remainder.
|
|
2783
3796
|
*/
|
|
2784
|
-
|
|
3797
|
+
rem(other: U8): U8;
|
|
2785
3798
|
/**
|
|
2786
|
-
*
|
|
2787
|
-
*
|
|
2788
|
-
* @param {Field} tvk The transition view key.
|
|
2789
|
-
*
|
|
2790
|
-
* @returns {Transition} The transition with public values for inputs and outputs.
|
|
3799
|
+
* Wrapped remainder.
|
|
2791
3800
|
*/
|
|
2792
|
-
|
|
3801
|
+
remWrapped(other: U8): U8;
|
|
3802
|
+
/**
|
|
3803
|
+
* Convert to Scalar.
|
|
3804
|
+
*/
|
|
3805
|
+
toScalar(): Scalar;
|
|
3806
|
+
/**
|
|
3807
|
+
* Convert to plaintext.
|
|
3808
|
+
*/
|
|
3809
|
+
toPlaintext(): Plaintext;
|
|
3810
|
+
/**
|
|
3811
|
+
* Convert from Field.
|
|
3812
|
+
*/
|
|
3813
|
+
static fromField(field: Field): U8;
|
|
3814
|
+
/**
|
|
3815
|
+
* Convert from Fields.
|
|
3816
|
+
*/
|
|
3817
|
+
static fromFields(fields: Array<any>): U8;
|
|
3818
|
+
/**
|
|
3819
|
+
* Clone.
|
|
3820
|
+
*/
|
|
3821
|
+
clone(): U8;
|
|
2793
3822
|
}
|
|
2794
3823
|
/**
|
|
2795
3824
|
* Verifying key for a function within an Aleo program
|