@algorandfoundation/algokit-utils 10.0.0-alpha.2 → 10.0.0-alpha.3
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/algo25/index.d.ts +2 -0
- package/algo25/index.js +9 -0
- package/algo25/index.mjs +3 -0
- package/package.json +1 -1
- package/packages/algo25/src/index.d.ts +40 -0
- package/packages/algo25/src/index.js +44 -0
- package/packages/algo25/src/index.js.map +1 -1
- package/packages/algo25/src/index.mjs +39 -1
- package/packages/algo25/src/index.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +11 -11
- package/types/algorand-client-transaction-sender.d.ts +11 -11
- package/types/app-client.d.ts +5 -5
- package/types/app-factory.d.ts +3 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { FAIL_TO_DECODE_MNEMONIC_ERROR_MSG, NOT_IN_WORDS_LIST_ERROR_MSG, masterDerivationKeyToMnemonic, mnemonicFromSeed, mnemonicToMasterDerivationKey, secretKeyToMnemonic, seedFromMnemonic } from "../packages/algo25/src/index.js";
|
|
2
|
+
export { FAIL_TO_DECODE_MNEMONIC_ERROR_MSG, NOT_IN_WORDS_LIST_ERROR_MSG, masterDerivationKeyToMnemonic, mnemonicFromSeed, mnemonicToMasterDerivationKey, secretKeyToMnemonic, seedFromMnemonic };
|
package/algo25/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const require_index = require('../packages/algo25/src/index.js');
|
|
2
|
+
|
|
3
|
+
exports.FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = require_index.FAIL_TO_DECODE_MNEMONIC_ERROR_MSG;
|
|
4
|
+
exports.NOT_IN_WORDS_LIST_ERROR_MSG = require_index.NOT_IN_WORDS_LIST_ERROR_MSG;
|
|
5
|
+
exports.masterDerivationKeyToMnemonic = require_index.masterDerivationKeyToMnemonic;
|
|
6
|
+
exports.mnemonicFromSeed = require_index.mnemonicFromSeed;
|
|
7
|
+
exports.mnemonicToMasterDerivationKey = require_index.mnemonicToMasterDerivationKey;
|
|
8
|
+
exports.secretKeyToMnemonic = require_index.secretKeyToMnemonic;
|
|
9
|
+
exports.seedFromMnemonic = require_index.seedFromMnemonic;
|
package/algo25/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FAIL_TO_DECODE_MNEMONIC_ERROR_MSG, NOT_IN_WORDS_LIST_ERROR_MSG, masterDerivationKeyToMnemonic, mnemonicFromSeed, mnemonicToMasterDerivationKey, secretKeyToMnemonic, seedFromMnemonic } from "../packages/algo25/src/index.mjs";
|
|
2
|
+
|
|
3
|
+
export { FAIL_TO_DECODE_MNEMONIC_ERROR_MSG, NOT_IN_WORDS_LIST_ERROR_MSG, masterDerivationKeyToMnemonic, mnemonicFromSeed, mnemonicToMasterDerivationKey, secretKeyToMnemonic, seedFromMnemonic };
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-utils",
|
|
9
|
-
"version": "10.0.0-alpha.
|
|
9
|
+
"version": "10.0.0-alpha.3",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
12
12
|
"author": "Algorand Foundation",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region packages/algo25/src/index.d.ts
|
|
2
|
+
declare const FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = "failed to decode mnemonic";
|
|
3
|
+
declare const NOT_IN_WORDS_LIST_ERROR_MSG = "the mnemonic contains a word that is not in the wordlist";
|
|
4
|
+
/**
|
|
5
|
+
* mnemonicFromSeed converts a 32-byte key into a 25 word mnemonic. The generated mnemonic includes a checksum.
|
|
6
|
+
* Each word in the mnemonic represents 11 bits of data, and the last 11 bits are reserved for the checksum.
|
|
7
|
+
* @param seed - 32 bytes long seed
|
|
8
|
+
* @returns 25 words mnemonic
|
|
9
|
+
*/
|
|
10
|
+
declare function mnemonicFromSeed(seed: Uint8Array): string;
|
|
11
|
+
/**
|
|
12
|
+
* seedFromMnemonic converts a mnemonic generated using this library into the source key used to create it.
|
|
13
|
+
* It returns an error if the passed mnemonic has an incorrect checksum, if the number of words is unexpected, or if one
|
|
14
|
+
* of the passed words is not found in the words list.
|
|
15
|
+
* @param mnemonic - 25 words mnemonic
|
|
16
|
+
* @returns 32 bytes long seed
|
|
17
|
+
*/
|
|
18
|
+
declare function seedFromMnemonic(mnemonic: string): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* secretKeyToMnemonic takes an Algorand secret key and returns the corresponding mnemonic.
|
|
21
|
+
* @param sk - Algorand secret key
|
|
22
|
+
* @returns Secret key's associated mnemonic
|
|
23
|
+
*/
|
|
24
|
+
declare function secretKeyToMnemonic(sk: Uint8Array): string;
|
|
25
|
+
/**
|
|
26
|
+
* mnemonicToMasterDerivationKey takes a mnemonic string and returns the corresponding master derivation key.
|
|
27
|
+
* @param mn - 25 words Algorand mnemonic
|
|
28
|
+
* @returns Uint8Array
|
|
29
|
+
* @throws error if fails to decode the mnemonic
|
|
30
|
+
*/
|
|
31
|
+
declare function mnemonicToMasterDerivationKey(mn: string): Uint8Array;
|
|
32
|
+
/**
|
|
33
|
+
* masterDerivationKeyToMnemonic takes a master derivation key and returns the corresponding mnemonic.
|
|
34
|
+
* @param mdk - Uint8Array
|
|
35
|
+
* @returns string mnemonic
|
|
36
|
+
*/
|
|
37
|
+
declare function masterDerivationKeyToMnemonic(mdk: Uint8Array): string;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { FAIL_TO_DECODE_MNEMONIC_ERROR_MSG, NOT_IN_WORDS_LIST_ERROR_MSG, masterDerivationKeyToMnemonic, mnemonicFromSeed, mnemonicToMasterDerivationKey, secretKeyToMnemonic, seedFromMnemonic };
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,6 +4,7 @@ const require_english = require('./english.js');
|
|
|
4
4
|
//#region packages/algo25/src/index.ts
|
|
5
5
|
const FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = "failed to decode mnemonic";
|
|
6
6
|
const NOT_IN_WORDS_LIST_ERROR_MSG = "the mnemonic contains a word that is not in the wordlist";
|
|
7
|
+
const SEED_BTYES_LENGTH = 32;
|
|
7
8
|
function toUint11Array(buffer8) {
|
|
8
9
|
const buffer11 = [];
|
|
9
10
|
let acc = 0;
|
|
@@ -30,6 +31,18 @@ function applyWords(nums) {
|
|
|
30
31
|
function computeChecksum(seed) {
|
|
31
32
|
return applyWords(toUint11Array(require_crypto.hash(seed)))[0];
|
|
32
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* mnemonicFromSeed converts a 32-byte key into a 25 word mnemonic. The generated mnemonic includes a checksum.
|
|
36
|
+
* Each word in the mnemonic represents 11 bits of data, and the last 11 bits are reserved for the checksum.
|
|
37
|
+
* @param seed - 32 bytes long seed
|
|
38
|
+
* @returns 25 words mnemonic
|
|
39
|
+
*/
|
|
40
|
+
function mnemonicFromSeed(seed) {
|
|
41
|
+
if (seed.length !== SEED_BTYES_LENGTH) throw new RangeError(`Seed length must be ${SEED_BTYES_LENGTH}`);
|
|
42
|
+
const words = applyWords(toUint11Array(seed));
|
|
43
|
+
const checksumWord = computeChecksum(seed);
|
|
44
|
+
return `${words.join(" ")} ${checksumWord}`;
|
|
45
|
+
}
|
|
33
46
|
function toUint8Array(buffer11) {
|
|
34
47
|
const buffer8 = [];
|
|
35
48
|
let acc = 0;
|
|
@@ -69,7 +82,38 @@ function seedFromMnemonic(mnemonic) {
|
|
|
69
82
|
if (computeChecksum(uint8Array) === checksum) return uint8Array;
|
|
70
83
|
throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG);
|
|
71
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* secretKeyToMnemonic takes an Algorand secret key and returns the corresponding mnemonic.
|
|
87
|
+
* @param sk - Algorand secret key
|
|
88
|
+
* @returns Secret key's associated mnemonic
|
|
89
|
+
*/
|
|
90
|
+
function secretKeyToMnemonic(sk) {
|
|
91
|
+
return mnemonicFromSeed(sk.slice(0, SEED_BTYES_LENGTH));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* mnemonicToMasterDerivationKey takes a mnemonic string and returns the corresponding master derivation key.
|
|
95
|
+
* @param mn - 25 words Algorand mnemonic
|
|
96
|
+
* @returns Uint8Array
|
|
97
|
+
* @throws error if fails to decode the mnemonic
|
|
98
|
+
*/
|
|
99
|
+
function mnemonicToMasterDerivationKey(mn) {
|
|
100
|
+
return seedFromMnemonic(mn);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* masterDerivationKeyToMnemonic takes a master derivation key and returns the corresponding mnemonic.
|
|
104
|
+
* @param mdk - Uint8Array
|
|
105
|
+
* @returns string mnemonic
|
|
106
|
+
*/
|
|
107
|
+
function masterDerivationKeyToMnemonic(mdk) {
|
|
108
|
+
return mnemonicFromSeed(mdk);
|
|
109
|
+
}
|
|
72
110
|
|
|
73
111
|
//#endregion
|
|
112
|
+
exports.FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = FAIL_TO_DECODE_MNEMONIC_ERROR_MSG;
|
|
113
|
+
exports.NOT_IN_WORDS_LIST_ERROR_MSG = NOT_IN_WORDS_LIST_ERROR_MSG;
|
|
114
|
+
exports.masterDerivationKeyToMnemonic = masterDerivationKeyToMnemonic;
|
|
115
|
+
exports.mnemonicFromSeed = mnemonicFromSeed;
|
|
116
|
+
exports.mnemonicToMasterDerivationKey = mnemonicToMasterDerivationKey;
|
|
117
|
+
exports.secretKeyToMnemonic = secretKeyToMnemonic;
|
|
74
118
|
exports.seedFromMnemonic = seedFromMnemonic;
|
|
75
119
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["buffer11: number[]","english","hash","buffer8: number[]"],"sources":["../../../../packages/algo25/src/index.ts"],"sourcesContent":["import english from './english.js'\nimport { hash } from '@algorandfoundation/algokit-common'\nexport const FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = 'failed to decode mnemonic'\nexport const NOT_IN_WORDS_LIST_ERROR_MSG = 'the mnemonic contains a word that is not in the wordlist'\n\nconst SEED_BTYES_LENGTH = 32\n\n// https://stackoverflow.com/a/51452614\nfunction toUint11Array(buffer8: Uint8Array | number[]): number[] {\n const buffer11: number[] = []\n let acc = 0\n let accBits = 0\n function add(octet: number) {\n acc |= octet << accBits\n accBits += 8\n if (accBits >= 11) {\n buffer11.push(acc & 0x7ff)\n acc >>= 11\n accBits -= 11\n }\n }\n function flush() {\n if (accBits) {\n buffer11.push(acc)\n }\n }\n\n buffer8.forEach(add)\n flush()\n return buffer11\n}\n\nfunction applyWords(nums: number[]): string[] {\n return nums.map((n) => english[n])\n}\n\nfunction computeChecksum(seed: Uint8Array): string {\n const hashBuffer = hash(seed)\n const uint11Hash = toUint11Array(hashBuffer)\n const words = applyWords(uint11Hash)\n\n return words[0]\n}\n\n/**\n * mnemonicFromSeed converts a 32-byte key into a 25 word mnemonic. The generated mnemonic includes a checksum.\n * Each word in the mnemonic represents 11 bits of data, and the last 11 bits are reserved for the checksum.\n * @param seed - 32 bytes long seed\n * @returns 25 words mnemonic\n */\nexport function mnemonicFromSeed(seed: Uint8Array) {\n // Sanity length check\n if (seed.length !== SEED_BTYES_LENGTH) {\n throw new RangeError(`Seed length must be ${SEED_BTYES_LENGTH}`)\n }\n\n const uint11Array = toUint11Array(seed)\n const words = applyWords(uint11Array)\n const checksumWord = computeChecksum(seed)\n\n return `${words.join(' ')} ${checksumWord}`\n}\n\n// from Uint11Array\n// https://stackoverflow.com/a/51452614\nfunction toUint8Array(buffer11: number[]): Uint8Array {\n const buffer8: number[] = []\n let acc = 0\n let accBits = 0\n function add(ui11: number) {\n acc |= ui11 << accBits\n accBits += 11\n while (accBits >= 8) {\n buffer8.push(acc & 0xff)\n acc >>= 8\n accBits -= 8\n }\n }\n function flush() {\n if (accBits) {\n buffer8.push(acc)\n }\n }\n\n buffer11.forEach(add)\n flush()\n return new Uint8Array(buffer8)\n}\n\n/**\n * seedFromMnemonic converts a mnemonic generated using this library into the source key used to create it.\n * It returns an error if the passed mnemonic has an incorrect checksum, if the number of words is unexpected, or if one\n * of the passed words is not found in the words list.\n * @param mnemonic - 25 words mnemonic\n * @returns 32 bytes long seed\n */\nexport function seedFromMnemonic(mnemonic: string) {\n const words = mnemonic.split(' ')\n const key = words.slice(0, 24)\n\n // Check that all words are in list\n for (const w of key) {\n if (english.indexOf(w) === -1) throw new Error(NOT_IN_WORDS_LIST_ERROR_MSG)\n }\n\n const checksum = words[words.length - 1]\n const uint11Array = key.map((word) => english.indexOf(word))\n\n // Convert the key to uint8Array\n let uint8Array = toUint8Array(uint11Array)\n\n // We need to chop the last byte -\n // the short explanation - Since 256 is not divisible by 11, we have an extra 0x0 byte.\n // The longer explanation - When splitting the 256 bits to chunks of 11, we get 23 words and a left over of 3 bits.\n // This left gets padded with another 8 bits to the create the 24th word.\n // While converting back to byte array, our new 264 bits array is divisible by 8 but the last byte is just the padding.\n\n // check that we have 33 bytes long array as expected\n if (uint8Array.length !== 33) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // check that the last byte is actually 0x0\n if (uint8Array[uint8Array.length - 1] !== 0x0) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // chop it !\n uint8Array = uint8Array.slice(0, uint8Array.length - 1)\n\n // compute checksum\n const cs = computeChecksum(uint8Array)\n\n // success!\n if (cs === checksum) return uint8Array\n\n throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n}\n\n/**\n * secretKeyToMnemonic takes an Algorand secret key and returns the corresponding mnemonic.\n * @param sk - Algorand secret key\n * @returns Secret key's associated mnemonic\n */\nexport function secretKeyToMnemonic(sk: Uint8Array) {\n // get the seed from the sk\n const seed = sk.slice(0, SEED_BTYES_LENGTH)\n return mnemonicFromSeed(seed)\n}\n\n/**\n * mnemonicToMasterDerivationKey takes a mnemonic string and returns the corresponding master derivation key.\n * @param mn - 25 words Algorand mnemonic\n * @returns Uint8Array\n * @throws error if fails to decode the mnemonic\n */\nexport function mnemonicToMasterDerivationKey(mn: string) {\n return seedFromMnemonic(mn)\n}\n\n/**\n * masterDerivationKeyToMnemonic takes a master derivation key and returns the corresponding mnemonic.\n * @param mdk - Uint8Array\n * @returns string mnemonic\n */\nexport function masterDerivationKeyToMnemonic(mdk: Uint8Array) {\n return mnemonicFromSeed(mdk)\n}\n"],"mappings":";;;;AAEA,MAAa,oCAAoC;AACjD,MAAa,8BAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","names":["buffer11: number[]","english","hash","buffer8: number[]"],"sources":["../../../../packages/algo25/src/index.ts"],"sourcesContent":["import english from './english.js'\nimport { hash } from '@algorandfoundation/algokit-common'\nexport const FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = 'failed to decode mnemonic'\nexport const NOT_IN_WORDS_LIST_ERROR_MSG = 'the mnemonic contains a word that is not in the wordlist'\n\nconst SEED_BTYES_LENGTH = 32\n\n// https://stackoverflow.com/a/51452614\nfunction toUint11Array(buffer8: Uint8Array | number[]): number[] {\n const buffer11: number[] = []\n let acc = 0\n let accBits = 0\n function add(octet: number) {\n acc |= octet << accBits\n accBits += 8\n if (accBits >= 11) {\n buffer11.push(acc & 0x7ff)\n acc >>= 11\n accBits -= 11\n }\n }\n function flush() {\n if (accBits) {\n buffer11.push(acc)\n }\n }\n\n buffer8.forEach(add)\n flush()\n return buffer11\n}\n\nfunction applyWords(nums: number[]): string[] {\n return nums.map((n) => english[n])\n}\n\nfunction computeChecksum(seed: Uint8Array): string {\n const hashBuffer = hash(seed)\n const uint11Hash = toUint11Array(hashBuffer)\n const words = applyWords(uint11Hash)\n\n return words[0]\n}\n\n/**\n * mnemonicFromSeed converts a 32-byte key into a 25 word mnemonic. The generated mnemonic includes a checksum.\n * Each word in the mnemonic represents 11 bits of data, and the last 11 bits are reserved for the checksum.\n * @param seed - 32 bytes long seed\n * @returns 25 words mnemonic\n */\nexport function mnemonicFromSeed(seed: Uint8Array) {\n // Sanity length check\n if (seed.length !== SEED_BTYES_LENGTH) {\n throw new RangeError(`Seed length must be ${SEED_BTYES_LENGTH}`)\n }\n\n const uint11Array = toUint11Array(seed)\n const words = applyWords(uint11Array)\n const checksumWord = computeChecksum(seed)\n\n return `${words.join(' ')} ${checksumWord}`\n}\n\n// from Uint11Array\n// https://stackoverflow.com/a/51452614\nfunction toUint8Array(buffer11: number[]): Uint8Array {\n const buffer8: number[] = []\n let acc = 0\n let accBits = 0\n function add(ui11: number) {\n acc |= ui11 << accBits\n accBits += 11\n while (accBits >= 8) {\n buffer8.push(acc & 0xff)\n acc >>= 8\n accBits -= 8\n }\n }\n function flush() {\n if (accBits) {\n buffer8.push(acc)\n }\n }\n\n buffer11.forEach(add)\n flush()\n return new Uint8Array(buffer8)\n}\n\n/**\n * seedFromMnemonic converts a mnemonic generated using this library into the source key used to create it.\n * It returns an error if the passed mnemonic has an incorrect checksum, if the number of words is unexpected, or if one\n * of the passed words is not found in the words list.\n * @param mnemonic - 25 words mnemonic\n * @returns 32 bytes long seed\n */\nexport function seedFromMnemonic(mnemonic: string) {\n const words = mnemonic.split(' ')\n const key = words.slice(0, 24)\n\n // Check that all words are in list\n for (const w of key) {\n if (english.indexOf(w) === -1) throw new Error(NOT_IN_WORDS_LIST_ERROR_MSG)\n }\n\n const checksum = words[words.length - 1]\n const uint11Array = key.map((word) => english.indexOf(word))\n\n // Convert the key to uint8Array\n let uint8Array = toUint8Array(uint11Array)\n\n // We need to chop the last byte -\n // the short explanation - Since 256 is not divisible by 11, we have an extra 0x0 byte.\n // The longer explanation - When splitting the 256 bits to chunks of 11, we get 23 words and a left over of 3 bits.\n // This left gets padded with another 8 bits to the create the 24th word.\n // While converting back to byte array, our new 264 bits array is divisible by 8 but the last byte is just the padding.\n\n // check that we have 33 bytes long array as expected\n if (uint8Array.length !== 33) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // check that the last byte is actually 0x0\n if (uint8Array[uint8Array.length - 1] !== 0x0) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // chop it !\n uint8Array = uint8Array.slice(0, uint8Array.length - 1)\n\n // compute checksum\n const cs = computeChecksum(uint8Array)\n\n // success!\n if (cs === checksum) return uint8Array\n\n throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n}\n\n/**\n * secretKeyToMnemonic takes an Algorand secret key and returns the corresponding mnemonic.\n * @param sk - Algorand secret key\n * @returns Secret key's associated mnemonic\n */\nexport function secretKeyToMnemonic(sk: Uint8Array) {\n // get the seed from the sk\n const seed = sk.slice(0, SEED_BTYES_LENGTH)\n return mnemonicFromSeed(seed)\n}\n\n/**\n * mnemonicToMasterDerivationKey takes a mnemonic string and returns the corresponding master derivation key.\n * @param mn - 25 words Algorand mnemonic\n * @returns Uint8Array\n * @throws error if fails to decode the mnemonic\n */\nexport function mnemonicToMasterDerivationKey(mn: string) {\n return seedFromMnemonic(mn)\n}\n\n/**\n * masterDerivationKeyToMnemonic takes a master derivation key and returns the corresponding mnemonic.\n * @param mdk - Uint8Array\n * @returns string mnemonic\n */\nexport function masterDerivationKeyToMnemonic(mdk: Uint8Array) {\n return mnemonicFromSeed(mdk)\n}\n"],"mappings":";;;;AAEA,MAAa,oCAAoC;AACjD,MAAa,8BAA8B;AAE3C,MAAM,oBAAoB;AAG1B,SAAS,cAAc,SAA0C;CAC/D,MAAMA,WAAqB,EAAE;CAC7B,IAAI,MAAM;CACV,IAAI,UAAU;CACd,SAAS,IAAI,OAAe;AAC1B,SAAO,SAAS;AAChB,aAAW;AACX,MAAI,WAAW,IAAI;AACjB,YAAS,KAAK,MAAM,KAAM;AAC1B,WAAQ;AACR,cAAW;;;CAGf,SAAS,QAAQ;AACf,MAAI,QACF,UAAS,KAAK,IAAI;;AAItB,SAAQ,QAAQ,IAAI;AACpB,QAAO;AACP,QAAO;;AAGT,SAAS,WAAW,MAA0B;AAC5C,QAAO,KAAK,KAAK,MAAMC,wBAAQ,GAAG;;AAGpC,SAAS,gBAAgB,MAA0B;AAKjD,QAFc,WADK,cADAC,oBAAK,KAAK,CACe,CACR,CAEvB;;;;;;;;AASf,SAAgB,iBAAiB,MAAkB;AAEjD,KAAI,KAAK,WAAW,kBAClB,OAAM,IAAI,WAAW,uBAAuB,oBAAoB;CAIlE,MAAM,QAAQ,WADM,cAAc,KAAK,CACF;CACrC,MAAM,eAAe,gBAAgB,KAAK;AAE1C,QAAO,GAAG,MAAM,KAAK,IAAI,CAAC,GAAG;;AAK/B,SAAS,aAAa,UAAgC;CACpD,MAAMC,UAAoB,EAAE;CAC5B,IAAI,MAAM;CACV,IAAI,UAAU;CACd,SAAS,IAAI,MAAc;AACzB,SAAO,QAAQ;AACf,aAAW;AACX,SAAO,WAAW,GAAG;AACnB,WAAQ,KAAK,MAAM,IAAK;AACxB,WAAQ;AACR,cAAW;;;CAGf,SAAS,QAAQ;AACf,MAAI,QACF,SAAQ,KAAK,IAAI;;AAIrB,UAAS,QAAQ,IAAI;AACrB,QAAO;AACP,QAAO,IAAI,WAAW,QAAQ;;;;;;;;;AAUhC,SAAgB,iBAAiB,UAAkB;CACjD,MAAM,QAAQ,SAAS,MAAM,IAAI;CACjC,MAAM,MAAM,MAAM,MAAM,GAAG,GAAG;AAG9B,MAAK,MAAM,KAAK,IACd,KAAIF,wBAAQ,QAAQ,EAAE,KAAK,GAAI,OAAM,IAAI,MAAM,4BAA4B;CAG7E,MAAM,WAAW,MAAM,MAAM,SAAS;CAItC,IAAI,aAAa,aAHG,IAAI,KAAK,SAASA,wBAAQ,QAAQ,KAAK,CAAC,CAGlB;AAS1C,KAAI,WAAW,WAAW,GAAI,OAAM,IAAI,MAAM,kCAAkC;AAGhF,KAAI,WAAW,WAAW,SAAS,OAAO,EAAK,OAAM,IAAI,MAAM,kCAAkC;AAGjG,cAAa,WAAW,MAAM,GAAG,WAAW,SAAS,EAAE;AAMvD,KAHW,gBAAgB,WAAW,KAG3B,SAAU,QAAO;AAE5B,OAAM,IAAI,MAAM,kCAAkC;;;;;;;AAQpD,SAAgB,oBAAoB,IAAgB;AAGlD,QAAO,iBADM,GAAG,MAAM,GAAG,kBAAkB,CACd;;;;;;;;AAS/B,SAAgB,8BAA8B,IAAY;AACxD,QAAO,iBAAiB,GAAG;;;;;;;AAQ7B,SAAgB,8BAA8B,KAAiB;AAC7D,QAAO,iBAAiB,IAAI"}
|
|
@@ -4,6 +4,7 @@ import english_default from "./english.mjs";
|
|
|
4
4
|
//#region packages/algo25/src/index.ts
|
|
5
5
|
const FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = "failed to decode mnemonic";
|
|
6
6
|
const NOT_IN_WORDS_LIST_ERROR_MSG = "the mnemonic contains a word that is not in the wordlist";
|
|
7
|
+
const SEED_BTYES_LENGTH = 32;
|
|
7
8
|
function toUint11Array(buffer8) {
|
|
8
9
|
const buffer11 = [];
|
|
9
10
|
let acc = 0;
|
|
@@ -30,6 +31,18 @@ function applyWords(nums) {
|
|
|
30
31
|
function computeChecksum(seed) {
|
|
31
32
|
return applyWords(toUint11Array(hash(seed)))[0];
|
|
32
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* mnemonicFromSeed converts a 32-byte key into a 25 word mnemonic. The generated mnemonic includes a checksum.
|
|
36
|
+
* Each word in the mnemonic represents 11 bits of data, and the last 11 bits are reserved for the checksum.
|
|
37
|
+
* @param seed - 32 bytes long seed
|
|
38
|
+
* @returns 25 words mnemonic
|
|
39
|
+
*/
|
|
40
|
+
function mnemonicFromSeed(seed) {
|
|
41
|
+
if (seed.length !== SEED_BTYES_LENGTH) throw new RangeError(`Seed length must be ${SEED_BTYES_LENGTH}`);
|
|
42
|
+
const words = applyWords(toUint11Array(seed));
|
|
43
|
+
const checksumWord = computeChecksum(seed);
|
|
44
|
+
return `${words.join(" ")} ${checksumWord}`;
|
|
45
|
+
}
|
|
33
46
|
function toUint8Array(buffer11) {
|
|
34
47
|
const buffer8 = [];
|
|
35
48
|
let acc = 0;
|
|
@@ -69,7 +82,32 @@ function seedFromMnemonic(mnemonic) {
|
|
|
69
82
|
if (computeChecksum(uint8Array) === checksum) return uint8Array;
|
|
70
83
|
throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG);
|
|
71
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* secretKeyToMnemonic takes an Algorand secret key and returns the corresponding mnemonic.
|
|
87
|
+
* @param sk - Algorand secret key
|
|
88
|
+
* @returns Secret key's associated mnemonic
|
|
89
|
+
*/
|
|
90
|
+
function secretKeyToMnemonic(sk) {
|
|
91
|
+
return mnemonicFromSeed(sk.slice(0, SEED_BTYES_LENGTH));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* mnemonicToMasterDerivationKey takes a mnemonic string and returns the corresponding master derivation key.
|
|
95
|
+
* @param mn - 25 words Algorand mnemonic
|
|
96
|
+
* @returns Uint8Array
|
|
97
|
+
* @throws error if fails to decode the mnemonic
|
|
98
|
+
*/
|
|
99
|
+
function mnemonicToMasterDerivationKey(mn) {
|
|
100
|
+
return seedFromMnemonic(mn);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* masterDerivationKeyToMnemonic takes a master derivation key and returns the corresponding mnemonic.
|
|
104
|
+
* @param mdk - Uint8Array
|
|
105
|
+
* @returns string mnemonic
|
|
106
|
+
*/
|
|
107
|
+
function masterDerivationKeyToMnemonic(mdk) {
|
|
108
|
+
return mnemonicFromSeed(mdk);
|
|
109
|
+
}
|
|
72
110
|
|
|
73
111
|
//#endregion
|
|
74
|
-
export { seedFromMnemonic };
|
|
112
|
+
export { FAIL_TO_DECODE_MNEMONIC_ERROR_MSG, NOT_IN_WORDS_LIST_ERROR_MSG, masterDerivationKeyToMnemonic, mnemonicFromSeed, mnemonicToMasterDerivationKey, secretKeyToMnemonic, seedFromMnemonic };
|
|
75
113
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["buffer11: number[]","english","buffer8: number[]"],"sources":["../../../../packages/algo25/src/index.ts"],"sourcesContent":["import english from './english.js'\nimport { hash } from '@algorandfoundation/algokit-common'\nexport const FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = 'failed to decode mnemonic'\nexport const NOT_IN_WORDS_LIST_ERROR_MSG = 'the mnemonic contains a word that is not in the wordlist'\n\nconst SEED_BTYES_LENGTH = 32\n\n// https://stackoverflow.com/a/51452614\nfunction toUint11Array(buffer8: Uint8Array | number[]): number[] {\n const buffer11: number[] = []\n let acc = 0\n let accBits = 0\n function add(octet: number) {\n acc |= octet << accBits\n accBits += 8\n if (accBits >= 11) {\n buffer11.push(acc & 0x7ff)\n acc >>= 11\n accBits -= 11\n }\n }\n function flush() {\n if (accBits) {\n buffer11.push(acc)\n }\n }\n\n buffer8.forEach(add)\n flush()\n return buffer11\n}\n\nfunction applyWords(nums: number[]): string[] {\n return nums.map((n) => english[n])\n}\n\nfunction computeChecksum(seed: Uint8Array): string {\n const hashBuffer = hash(seed)\n const uint11Hash = toUint11Array(hashBuffer)\n const words = applyWords(uint11Hash)\n\n return words[0]\n}\n\n/**\n * mnemonicFromSeed converts a 32-byte key into a 25 word mnemonic. The generated mnemonic includes a checksum.\n * Each word in the mnemonic represents 11 bits of data, and the last 11 bits are reserved for the checksum.\n * @param seed - 32 bytes long seed\n * @returns 25 words mnemonic\n */\nexport function mnemonicFromSeed(seed: Uint8Array) {\n // Sanity length check\n if (seed.length !== SEED_BTYES_LENGTH) {\n throw new RangeError(`Seed length must be ${SEED_BTYES_LENGTH}`)\n }\n\n const uint11Array = toUint11Array(seed)\n const words = applyWords(uint11Array)\n const checksumWord = computeChecksum(seed)\n\n return `${words.join(' ')} ${checksumWord}`\n}\n\n// from Uint11Array\n// https://stackoverflow.com/a/51452614\nfunction toUint8Array(buffer11: number[]): Uint8Array {\n const buffer8: number[] = []\n let acc = 0\n let accBits = 0\n function add(ui11: number) {\n acc |= ui11 << accBits\n accBits += 11\n while (accBits >= 8) {\n buffer8.push(acc & 0xff)\n acc >>= 8\n accBits -= 8\n }\n }\n function flush() {\n if (accBits) {\n buffer8.push(acc)\n }\n }\n\n buffer11.forEach(add)\n flush()\n return new Uint8Array(buffer8)\n}\n\n/**\n * seedFromMnemonic converts a mnemonic generated using this library into the source key used to create it.\n * It returns an error if the passed mnemonic has an incorrect checksum, if the number of words is unexpected, or if one\n * of the passed words is not found in the words list.\n * @param mnemonic - 25 words mnemonic\n * @returns 32 bytes long seed\n */\nexport function seedFromMnemonic(mnemonic: string) {\n const words = mnemonic.split(' ')\n const key = words.slice(0, 24)\n\n // Check that all words are in list\n for (const w of key) {\n if (english.indexOf(w) === -1) throw new Error(NOT_IN_WORDS_LIST_ERROR_MSG)\n }\n\n const checksum = words[words.length - 1]\n const uint11Array = key.map((word) => english.indexOf(word))\n\n // Convert the key to uint8Array\n let uint8Array = toUint8Array(uint11Array)\n\n // We need to chop the last byte -\n // the short explanation - Since 256 is not divisible by 11, we have an extra 0x0 byte.\n // The longer explanation - When splitting the 256 bits to chunks of 11, we get 23 words and a left over of 3 bits.\n // This left gets padded with another 8 bits to the create the 24th word.\n // While converting back to byte array, our new 264 bits array is divisible by 8 but the last byte is just the padding.\n\n // check that we have 33 bytes long array as expected\n if (uint8Array.length !== 33) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // check that the last byte is actually 0x0\n if (uint8Array[uint8Array.length - 1] !== 0x0) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // chop it !\n uint8Array = uint8Array.slice(0, uint8Array.length - 1)\n\n // compute checksum\n const cs = computeChecksum(uint8Array)\n\n // success!\n if (cs === checksum) return uint8Array\n\n throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n}\n\n/**\n * secretKeyToMnemonic takes an Algorand secret key and returns the corresponding mnemonic.\n * @param sk - Algorand secret key\n * @returns Secret key's associated mnemonic\n */\nexport function secretKeyToMnemonic(sk: Uint8Array) {\n // get the seed from the sk\n const seed = sk.slice(0, SEED_BTYES_LENGTH)\n return mnemonicFromSeed(seed)\n}\n\n/**\n * mnemonicToMasterDerivationKey takes a mnemonic string and returns the corresponding master derivation key.\n * @param mn - 25 words Algorand mnemonic\n * @returns Uint8Array\n * @throws error if fails to decode the mnemonic\n */\nexport function mnemonicToMasterDerivationKey(mn: string) {\n return seedFromMnemonic(mn)\n}\n\n/**\n * masterDerivationKeyToMnemonic takes a master derivation key and returns the corresponding mnemonic.\n * @param mdk - Uint8Array\n * @returns string mnemonic\n */\nexport function masterDerivationKeyToMnemonic(mdk: Uint8Array) {\n return mnemonicFromSeed(mdk)\n}\n"],"mappings":";;;;AAEA,MAAa,oCAAoC;AACjD,MAAa,8BAA8B;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["buffer11: number[]","english","buffer8: number[]"],"sources":["../../../../packages/algo25/src/index.ts"],"sourcesContent":["import english from './english.js'\nimport { hash } from '@algorandfoundation/algokit-common'\nexport const FAIL_TO_DECODE_MNEMONIC_ERROR_MSG = 'failed to decode mnemonic'\nexport const NOT_IN_WORDS_LIST_ERROR_MSG = 'the mnemonic contains a word that is not in the wordlist'\n\nconst SEED_BTYES_LENGTH = 32\n\n// https://stackoverflow.com/a/51452614\nfunction toUint11Array(buffer8: Uint8Array | number[]): number[] {\n const buffer11: number[] = []\n let acc = 0\n let accBits = 0\n function add(octet: number) {\n acc |= octet << accBits\n accBits += 8\n if (accBits >= 11) {\n buffer11.push(acc & 0x7ff)\n acc >>= 11\n accBits -= 11\n }\n }\n function flush() {\n if (accBits) {\n buffer11.push(acc)\n }\n }\n\n buffer8.forEach(add)\n flush()\n return buffer11\n}\n\nfunction applyWords(nums: number[]): string[] {\n return nums.map((n) => english[n])\n}\n\nfunction computeChecksum(seed: Uint8Array): string {\n const hashBuffer = hash(seed)\n const uint11Hash = toUint11Array(hashBuffer)\n const words = applyWords(uint11Hash)\n\n return words[0]\n}\n\n/**\n * mnemonicFromSeed converts a 32-byte key into a 25 word mnemonic. The generated mnemonic includes a checksum.\n * Each word in the mnemonic represents 11 bits of data, and the last 11 bits are reserved for the checksum.\n * @param seed - 32 bytes long seed\n * @returns 25 words mnemonic\n */\nexport function mnemonicFromSeed(seed: Uint8Array) {\n // Sanity length check\n if (seed.length !== SEED_BTYES_LENGTH) {\n throw new RangeError(`Seed length must be ${SEED_BTYES_LENGTH}`)\n }\n\n const uint11Array = toUint11Array(seed)\n const words = applyWords(uint11Array)\n const checksumWord = computeChecksum(seed)\n\n return `${words.join(' ')} ${checksumWord}`\n}\n\n// from Uint11Array\n// https://stackoverflow.com/a/51452614\nfunction toUint8Array(buffer11: number[]): Uint8Array {\n const buffer8: number[] = []\n let acc = 0\n let accBits = 0\n function add(ui11: number) {\n acc |= ui11 << accBits\n accBits += 11\n while (accBits >= 8) {\n buffer8.push(acc & 0xff)\n acc >>= 8\n accBits -= 8\n }\n }\n function flush() {\n if (accBits) {\n buffer8.push(acc)\n }\n }\n\n buffer11.forEach(add)\n flush()\n return new Uint8Array(buffer8)\n}\n\n/**\n * seedFromMnemonic converts a mnemonic generated using this library into the source key used to create it.\n * It returns an error if the passed mnemonic has an incorrect checksum, if the number of words is unexpected, or if one\n * of the passed words is not found in the words list.\n * @param mnemonic - 25 words mnemonic\n * @returns 32 bytes long seed\n */\nexport function seedFromMnemonic(mnemonic: string) {\n const words = mnemonic.split(' ')\n const key = words.slice(0, 24)\n\n // Check that all words are in list\n for (const w of key) {\n if (english.indexOf(w) === -1) throw new Error(NOT_IN_WORDS_LIST_ERROR_MSG)\n }\n\n const checksum = words[words.length - 1]\n const uint11Array = key.map((word) => english.indexOf(word))\n\n // Convert the key to uint8Array\n let uint8Array = toUint8Array(uint11Array)\n\n // We need to chop the last byte -\n // the short explanation - Since 256 is not divisible by 11, we have an extra 0x0 byte.\n // The longer explanation - When splitting the 256 bits to chunks of 11, we get 23 words and a left over of 3 bits.\n // This left gets padded with another 8 bits to the create the 24th word.\n // While converting back to byte array, our new 264 bits array is divisible by 8 but the last byte is just the padding.\n\n // check that we have 33 bytes long array as expected\n if (uint8Array.length !== 33) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // check that the last byte is actually 0x0\n if (uint8Array[uint8Array.length - 1] !== 0x0) throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n\n // chop it !\n uint8Array = uint8Array.slice(0, uint8Array.length - 1)\n\n // compute checksum\n const cs = computeChecksum(uint8Array)\n\n // success!\n if (cs === checksum) return uint8Array\n\n throw new Error(FAIL_TO_DECODE_MNEMONIC_ERROR_MSG)\n}\n\n/**\n * secretKeyToMnemonic takes an Algorand secret key and returns the corresponding mnemonic.\n * @param sk - Algorand secret key\n * @returns Secret key's associated mnemonic\n */\nexport function secretKeyToMnemonic(sk: Uint8Array) {\n // get the seed from the sk\n const seed = sk.slice(0, SEED_BTYES_LENGTH)\n return mnemonicFromSeed(seed)\n}\n\n/**\n * mnemonicToMasterDerivationKey takes a mnemonic string and returns the corresponding master derivation key.\n * @param mn - 25 words Algorand mnemonic\n * @returns Uint8Array\n * @throws error if fails to decode the mnemonic\n */\nexport function mnemonicToMasterDerivationKey(mn: string) {\n return seedFromMnemonic(mn)\n}\n\n/**\n * masterDerivationKeyToMnemonic takes a master derivation key and returns the corresponding mnemonic.\n * @param mdk - Uint8Array\n * @returns string mnemonic\n */\nexport function masterDerivationKeyToMnemonic(mdk: Uint8Array) {\n return mnemonicFromSeed(mdk)\n}\n"],"mappings":";;;;AAEA,MAAa,oCAAoC;AACjD,MAAa,8BAA8B;AAE3C,MAAM,oBAAoB;AAG1B,SAAS,cAAc,SAA0C;CAC/D,MAAMA,WAAqB,EAAE;CAC7B,IAAI,MAAM;CACV,IAAI,UAAU;CACd,SAAS,IAAI,OAAe;AAC1B,SAAO,SAAS;AAChB,aAAW;AACX,MAAI,WAAW,IAAI;AACjB,YAAS,KAAK,MAAM,KAAM;AAC1B,WAAQ;AACR,cAAW;;;CAGf,SAAS,QAAQ;AACf,MAAI,QACF,UAAS,KAAK,IAAI;;AAItB,SAAQ,QAAQ,IAAI;AACpB,QAAO;AACP,QAAO;;AAGT,SAAS,WAAW,MAA0B;AAC5C,QAAO,KAAK,KAAK,MAAMC,gBAAQ,GAAG;;AAGpC,SAAS,gBAAgB,MAA0B;AAKjD,QAFc,WADK,cADA,KAAK,KAAK,CACe,CACR,CAEvB;;;;;;;;AASf,SAAgB,iBAAiB,MAAkB;AAEjD,KAAI,KAAK,WAAW,kBAClB,OAAM,IAAI,WAAW,uBAAuB,oBAAoB;CAIlE,MAAM,QAAQ,WADM,cAAc,KAAK,CACF;CACrC,MAAM,eAAe,gBAAgB,KAAK;AAE1C,QAAO,GAAG,MAAM,KAAK,IAAI,CAAC,GAAG;;AAK/B,SAAS,aAAa,UAAgC;CACpD,MAAMC,UAAoB,EAAE;CAC5B,IAAI,MAAM;CACV,IAAI,UAAU;CACd,SAAS,IAAI,MAAc;AACzB,SAAO,QAAQ;AACf,aAAW;AACX,SAAO,WAAW,GAAG;AACnB,WAAQ,KAAK,MAAM,IAAK;AACxB,WAAQ;AACR,cAAW;;;CAGf,SAAS,QAAQ;AACf,MAAI,QACF,SAAQ,KAAK,IAAI;;AAIrB,UAAS,QAAQ,IAAI;AACrB,QAAO;AACP,QAAO,IAAI,WAAW,QAAQ;;;;;;;;;AAUhC,SAAgB,iBAAiB,UAAkB;CACjD,MAAM,QAAQ,SAAS,MAAM,IAAI;CACjC,MAAM,MAAM,MAAM,MAAM,GAAG,GAAG;AAG9B,MAAK,MAAM,KAAK,IACd,KAAID,gBAAQ,QAAQ,EAAE,KAAK,GAAI,OAAM,IAAI,MAAM,4BAA4B;CAG7E,MAAM,WAAW,MAAM,MAAM,SAAS;CAItC,IAAI,aAAa,aAHG,IAAI,KAAK,SAASA,gBAAQ,QAAQ,KAAK,CAAC,CAGlB;AAS1C,KAAI,WAAW,WAAW,GAAI,OAAM,IAAI,MAAM,kCAAkC;AAGhF,KAAI,WAAW,WAAW,SAAS,OAAO,EAAK,OAAM,IAAI,MAAM,kCAAkC;AAGjG,cAAa,WAAW,MAAM,GAAG,WAAW,SAAS,EAAE;AAMvD,KAHW,gBAAgB,WAAW,KAG3B,SAAU,QAAO;AAE5B,OAAM,IAAI,MAAM,kCAAkC;;;;;;;AAQpD,SAAgB,oBAAoB,IAAgB;AAGlD,QAAO,iBADM,GAAG,MAAM,GAAG,kBAAkB,CACd;;;;;;;;AAS/B,SAAgB,8BAA8B,IAAY;AACxD,QAAO,iBAAiB,GAAG;;;;;;;AAQ7B,SAAgB,8BAA8B,KAAiB;AAC7D,QAAO,iBAAiB,IAAI"}
|
|
@@ -573,14 +573,9 @@ declare class AlgorandClientTransactionCreator {
|
|
|
573
573
|
validityWindow?: number | bigint | undefined;
|
|
574
574
|
firstValidRound?: bigint | undefined;
|
|
575
575
|
lastValidRound?: bigint | undefined;
|
|
576
|
-
schema?: {
|
|
577
|
-
globalInts: number;
|
|
578
|
-
globalByteSlices: number;
|
|
579
|
-
localInts: number;
|
|
580
|
-
localByteSlices: number;
|
|
581
|
-
} | undefined;
|
|
582
576
|
approvalProgram: string | Uint8Array;
|
|
583
577
|
clearStateProgram: string | Uint8Array;
|
|
578
|
+
extraProgramPages?: number | undefined;
|
|
584
579
|
onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
|
|
585
580
|
accountReferences?: ReadableAddress[] | undefined;
|
|
586
581
|
appReferences?: bigint[] | undefined;
|
|
@@ -588,9 +583,14 @@ declare class AlgorandClientTransactionCreator {
|
|
|
588
583
|
boxReferences?: (BoxIdentifier | BoxReference)[] | undefined;
|
|
589
584
|
accessReferences?: AccessReference[] | undefined;
|
|
590
585
|
rejectVersion?: number | undefined;
|
|
591
|
-
|
|
586
|
+
schema?: {
|
|
587
|
+
globalInts: number;
|
|
588
|
+
globalByteSlices: number;
|
|
589
|
+
localInts: number;
|
|
590
|
+
localByteSlices: number;
|
|
591
|
+
} | undefined;
|
|
592
592
|
method: ABIMethod;
|
|
593
|
-
args?: (Transaction | ABIValue |
|
|
593
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
594
594
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
595
595
|
sender: SendingAddress;
|
|
596
596
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -715,7 +715,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
715
715
|
accessReferences?: AccessReference[] | undefined;
|
|
716
716
|
rejectVersion?: number | undefined;
|
|
717
717
|
method: ABIMethod;
|
|
718
|
-
args?: (Transaction | ABIValue |
|
|
718
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
719
719
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
720
720
|
sender: SendingAddress;
|
|
721
721
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -836,7 +836,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
836
836
|
accessReferences?: AccessReference[] | undefined;
|
|
837
837
|
rejectVersion?: number | undefined;
|
|
838
838
|
method: ABIMethod;
|
|
839
|
-
args?: (Transaction | ABIValue |
|
|
839
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
840
840
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
841
841
|
sender: SendingAddress;
|
|
842
842
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -957,7 +957,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
957
957
|
accessReferences?: AccessReference[] | undefined;
|
|
958
958
|
rejectVersion?: number | undefined;
|
|
959
959
|
method: ABIMethod;
|
|
960
|
-
args?: (Transaction | ABIValue |
|
|
960
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
961
961
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
962
962
|
sender: SendingAddress;
|
|
963
963
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -757,14 +757,9 @@ declare class AlgorandClientTransactionSender {
|
|
|
757
757
|
validityWindow?: number | bigint | undefined;
|
|
758
758
|
firstValidRound?: bigint | undefined;
|
|
759
759
|
lastValidRound?: bigint | undefined;
|
|
760
|
-
schema?: {
|
|
761
|
-
globalInts: number;
|
|
762
|
-
globalByteSlices: number;
|
|
763
|
-
localInts: number;
|
|
764
|
-
localByteSlices: number;
|
|
765
|
-
} | undefined;
|
|
766
760
|
approvalProgram: string | Uint8Array;
|
|
767
761
|
clearStateProgram: string | Uint8Array;
|
|
762
|
+
extraProgramPages?: number | undefined;
|
|
768
763
|
onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
|
|
769
764
|
accountReferences?: ReadableAddress[] | undefined;
|
|
770
765
|
appReferences?: bigint[] | undefined;
|
|
@@ -772,9 +767,14 @@ declare class AlgorandClientTransactionSender {
|
|
|
772
767
|
boxReferences?: (BoxIdentifier | BoxReference)[] | undefined;
|
|
773
768
|
accessReferences?: AccessReference[] | undefined;
|
|
774
769
|
rejectVersion?: number | undefined;
|
|
775
|
-
|
|
770
|
+
schema?: {
|
|
771
|
+
globalInts: number;
|
|
772
|
+
globalByteSlices: number;
|
|
773
|
+
localInts: number;
|
|
774
|
+
localByteSlices: number;
|
|
775
|
+
} | undefined;
|
|
776
776
|
method: ABIMethod;
|
|
777
|
-
args?: (Transaction | ABIValue |
|
|
777
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
778
778
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
779
779
|
sender: SendingAddress;
|
|
780
780
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -906,7 +906,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
906
906
|
accessReferences?: AccessReference[] | undefined;
|
|
907
907
|
rejectVersion?: number | undefined;
|
|
908
908
|
method: ABIMethod;
|
|
909
|
-
args?: (Transaction | ABIValue |
|
|
909
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
910
910
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
911
911
|
sender: SendingAddress;
|
|
912
912
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -1034,7 +1034,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
1034
1034
|
accessReferences?: AccessReference[] | undefined;
|
|
1035
1035
|
rejectVersion?: number | undefined;
|
|
1036
1036
|
method: ABIMethod;
|
|
1037
|
-
args?: (Transaction | ABIValue |
|
|
1037
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
1038
1038
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
1039
1039
|
sender: SendingAddress;
|
|
1040
1040
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -1162,7 +1162,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
1162
1162
|
accessReferences?: AccessReference[] | undefined;
|
|
1163
1163
|
rejectVersion?: number | undefined;
|
|
1164
1164
|
method: ABIMethod;
|
|
1165
|
-
args?: (Transaction | ABIValue |
|
|
1165
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
1166
1166
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
1167
1167
|
sender: SendingAddress;
|
|
1168
1168
|
rekeyTo?: ReadableAddress | undefined;
|
package/types/app-client.d.ts
CHANGED
|
@@ -488,7 +488,7 @@ declare class AppClient {
|
|
|
488
488
|
signer: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
489
489
|
method: ABIMethod;
|
|
490
490
|
onComplete: OnApplicationComplete.UpdateApplication;
|
|
491
|
-
args: (Transaction | ABIValue |
|
|
491
|
+
args: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
492
492
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
493
493
|
sender: SendingAddress;
|
|
494
494
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -589,7 +589,7 @@ declare class AppClient {
|
|
|
589
589
|
accessReferences?: AccessReference[] | undefined;
|
|
590
590
|
rejectVersion?: number | undefined;
|
|
591
591
|
method: ABIMethod;
|
|
592
|
-
args?: (Transaction | ABIValue |
|
|
592
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
593
593
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
594
594
|
sender: SendingAddress;
|
|
595
595
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -690,7 +690,7 @@ declare class AppClient {
|
|
|
690
690
|
accessReferences?: AccessReference[] | undefined;
|
|
691
691
|
rejectVersion?: number | undefined;
|
|
692
692
|
method: ABIMethod;
|
|
693
|
-
args?: (Transaction | ABIValue |
|
|
693
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
694
694
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
695
695
|
sender: SendingAddress;
|
|
696
696
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -790,7 +790,7 @@ declare class AppClient {
|
|
|
790
790
|
accessReferences?: AccessReference[] | undefined;
|
|
791
791
|
rejectVersion?: number | undefined;
|
|
792
792
|
method: ABIMethod;
|
|
793
|
-
args?: (Transaction | ABIValue |
|
|
793
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
794
794
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
795
795
|
sender: SendingAddress;
|
|
796
796
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -890,7 +890,7 @@ declare class AppClient {
|
|
|
890
890
|
accessReferences?: AccessReference[] | undefined;
|
|
891
891
|
rejectVersion?: number | undefined;
|
|
892
892
|
method: ABIMethod;
|
|
893
|
-
args?: (Transaction | ABIValue |
|
|
893
|
+
args?: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
894
894
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
895
895
|
sender: SendingAddress;
|
|
896
896
|
rekeyTo?: ReadableAddress | undefined;
|
package/types/app-factory.d.ts
CHANGED
|
@@ -246,7 +246,7 @@ declare class AppFactory {
|
|
|
246
246
|
sender: Address;
|
|
247
247
|
signer: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
248
248
|
method: ABIMethod;
|
|
249
|
-
args: (Transaction | ABIValue |
|
|
249
|
+
args: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
250
250
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
251
251
|
sender: SendingAddress;
|
|
252
252
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -348,7 +348,7 @@ declare class AppFactory {
|
|
|
348
348
|
sender: Address;
|
|
349
349
|
signer: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
350
350
|
method: ABIMethod;
|
|
351
|
-
args: (Transaction | ABIValue |
|
|
351
|
+
args: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
352
352
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
353
353
|
sender: SendingAddress;
|
|
354
354
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -450,7 +450,7 @@ declare class AppFactory {
|
|
|
450
450
|
sender: Address;
|
|
451
451
|
signer: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
452
452
|
method: ABIMethod;
|
|
453
|
-
args: (Transaction | ABIValue |
|
|
453
|
+
args: (Transaction | ABIValue | Promise<Transaction> | TransactionWithSigner | AppMethodCall<{
|
|
454
454
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
455
455
|
sender: SendingAddress;
|
|
456
456
|
rekeyTo?: ReadableAddress | undefined;
|