algosdk 3.6.0 → 3.7.0
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/README.md +4 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/appAccess.js +4 -0
- package/dist/cjs/appAccess.js.map +1 -1
- package/dist/cjs/client/v2/algod/algod.js +0 -18
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +153 -437
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +163 -12
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/composer.js +4 -6
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/ed25519-signer.js +76 -0
- package/dist/cjs/ed25519-signer.js.map +1 -0
- package/dist/cjs/encoding/address.js +61 -1
- package/dist/cjs/encoding/address.js.map +1 -1
- package/dist/cjs/falcon-signer.js +17 -0
- package/dist/cjs/falcon-signer.js.map +1 -0
- package/dist/cjs/heartbeat.js +7 -0
- package/dist/cjs/heartbeat.js.map +1 -1
- package/dist/cjs/logicsig.js +201 -16
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/main.js +32 -63
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/makeTxn.js +11 -2
- package/dist/cjs/makeTxn.js.map +1 -1
- package/dist/cjs/mnemonic/mnemonic.js +26 -1
- package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
- package/dist/cjs/multisigSigning.js +78 -1
- package/dist/cjs/multisigSigning.js.map +1 -1
- package/dist/cjs/pq-signer.js +80 -0
- package/dist/cjs/pq-signer.js.map +1 -0
- package/dist/cjs/signedTransaction.js +15 -1
- package/dist/cjs/signedTransaction.js.map +1 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/signing.js +94 -7
- package/dist/cjs/signing.js.map +1 -1
- package/dist/cjs/transaction.js +17 -1
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/cjs/types/statedelta.js +17 -0
- package/dist/cjs/types/statedelta.js.map +1 -1
- package/dist/cjs/types/transactions/encoded.js +51 -1
- package/dist/cjs/types/transactions/encoded.js.map +1 -1
- package/dist/cjs/utils/ed25519-check.js +69 -0
- package/dist/cjs/utils/ed25519-check.js.map +1 -0
- package/dist/cjs/utils/utils.js +14 -1
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/esm/appAccess.js +4 -0
- package/dist/esm/appAccess.js.map +1 -1
- package/dist/esm/client/v2/algod/algod.js +0 -18
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +149 -430
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +161 -11
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/composer.js +4 -6
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/ed25519-signer.js +72 -0
- package/dist/esm/ed25519-signer.js.map +1 -0
- package/dist/esm/encoding/address.js +58 -0
- package/dist/esm/encoding/address.js.map +1 -1
- package/dist/esm/falcon-signer.js +13 -0
- package/dist/esm/falcon-signer.js.map +1 -0
- package/dist/esm/heartbeat.js +8 -1
- package/dist/esm/heartbeat.js.map +1 -1
- package/dist/esm/logicsig.js +200 -15
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/main.js +8 -56
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/makeTxn.js +11 -2
- package/dist/esm/makeTxn.js.map +1 -1
- package/dist/esm/mnemonic/mnemonic.js +25 -1
- package/dist/esm/mnemonic/mnemonic.js.map +1 -1
- package/dist/esm/multisigSigning.js +75 -0
- package/dist/esm/multisigSigning.js.map +1 -1
- package/dist/esm/pq-signer.js +76 -0
- package/dist/esm/pq-signer.js.map +1 -0
- package/dist/esm/signedTransaction.js +16 -2
- package/dist/esm/signedTransaction.js.map +1 -1
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/signing.js +91 -8
- package/dist/esm/signing.js.map +1 -1
- package/dist/esm/transaction.js +17 -1
- package/dist/esm/transaction.js.map +1 -1
- package/dist/esm/types/statedelta.js +17 -0
- package/dist/esm/types/statedelta.js.map +1 -1
- package/dist/esm/types/transactions/encoded.js +49 -1
- package/dist/esm/types/transactions/encoded.js.map +1 -1
- package/dist/esm/utils/ed25519-check.js +65 -0
- package/dist/esm/utils/ed25519-check.js.map +1 -0
- package/dist/esm/utils/utils.js +12 -0
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/types/client/v2/algod/algod.d.ts +0 -16
- package/dist/types/client/v2/algod/models/types.d.ts +90 -220
- package/dist/types/client/v2/indexer/models/types.d.ts +114 -7
- package/dist/types/composer.d.ts +3 -3
- package/dist/types/ed25519-signer.d.ts +7 -0
- package/dist/types/encoding/address.d.ts +37 -0
- package/dist/types/falcon-signer.d.ts +11 -0
- package/dist/types/heartbeat.d.ts +2 -0
- package/dist/types/logicsig.d.ts +72 -1
- package/dist/types/main.d.ts +8 -44
- package/dist/types/makeTxn.d.ts +8 -2
- package/dist/types/mnemonic/mnemonic.d.ts +13 -0
- package/dist/types/multisigSigning.d.ts +49 -0
- package/dist/types/pq-signer.d.ts +8 -0
- package/dist/types/signedTransaction.d.ts +7 -2
- package/dist/types/signer.d.ts +46 -0
- package/dist/types/signing.d.ts +45 -0
- package/dist/types/transaction.d.ts +10 -0
- package/dist/types/types/statedelta.d.ts +18 -0
- package/dist/types/types/transactions/base.d.ts +10 -0
- package/dist/types/types/transactions/encoded.d.ts +27 -0
- package/dist/types/utils/ed25519-check.d.ts +10 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -1
- package/src/appAccess.ts +5 -0
- package/src/client/v2/algod/algod.ts +0 -19
- package/src/client/v2/algod/models/types.ts +324 -790
- package/src/client/v2/indexer/models/types.ts +280 -8
- package/src/composer.ts +7 -11
- package/src/ed25519-signer.ts +125 -0
- package/src/encoding/address.ts +80 -0
- package/src/falcon-signer.ts +33 -0
- package/src/heartbeat.ts +11 -0
- package/src/logicsig.ts +258 -16
- package/src/main.ts +30 -60
- package/src/makeTxn.ts +13 -4
- package/src/mnemonic/mnemonic.ts +34 -1
- package/src/multisigSigning.ts +111 -0
- package/src/pq-signer.ts +123 -0
- package/src/signedTransaction.ts +24 -0
- package/src/signer.ts +62 -0
- package/src/signing.ts +109 -8
- package/src/transaction.ts +19 -1
- package/src/types/statedelta.ts +34 -0
- package/src/types/transactions/base.ts +11 -0
- package/src/types/transactions/encoded.ts +88 -0
- package/src/utils/ed25519-check.ts +67 -0
- package/src/utils/utils.ts +13 -0
- package/dist/cjs/client/v2/algod/dryrun.js +0 -34
- package/dist/cjs/client/v2/algod/dryrun.js.map +0 -1
- package/dist/cjs/dryrun.js +0 -214
- package/dist/cjs/dryrun.js.map +0 -1
- package/dist/esm/client/v2/algod/dryrun.js +0 -28
- package/dist/esm/client/v2/algod/dryrun.js.map +0 -1
- package/dist/esm/dryrun.js +0 -208
- package/dist/esm/dryrun.js.map +0 -1
- package/dist/types/client/v2/algod/dryrun.d.ts +0 -11
- package/dist/types/dryrun.d.ts +0 -28
- package/src/client/v2/algod/dryrun.ts +0 -38
- package/src/dryrun.ts +0 -292
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Address } from './encoding/address.js';
|
|
2
|
+
import { AddressWithDelegatedLsigSigner, AddressWithMxBytesSigner, AddressWithProgramDataSigner, AddressWithTransactionSigner } from './signer.js';
|
|
3
|
+
export interface Ed25519SigningKey {
|
|
4
|
+
ed25519PublicKey: Uint8Array;
|
|
5
|
+
ed25519Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
6
|
+
}
|
|
7
|
+
export declare function addressWithSignersFromRawEd25519Signer(ed25519SigningKey: Ed25519SigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithMxBytesSigner & AddressWithProgramDataSigner;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
import type { EncodedPQSig } from '../types/transactions/encoded.js';
|
|
1
2
|
export declare const ALGORAND_ADDRESS_BYTE_LENGTH = 36;
|
|
2
3
|
export declare const ALGORAND_CHECKSUM_BYTE_LENGTH = 4;
|
|
3
4
|
export declare const ALGORAND_ADDRESS_LENGTH = 58;
|
|
4
5
|
export declare const ALGORAND_ZERO_ADDRESS_STRING = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ";
|
|
5
6
|
export declare const MALFORMED_ADDRESS_ERROR_MSG = "address seems to be malformed";
|
|
6
7
|
export declare const CHECKSUM_ADDRESS_ERROR_MSG = "wrong checksum for address";
|
|
8
|
+
/**
|
|
9
|
+
* The required byte length of a post-quantum signature scheme identifier.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PQ_SCHEME_SIZE = 2;
|
|
12
|
+
/**
|
|
13
|
+
* The largest value a post-quantum address salt may take. The salt occupies a
|
|
14
|
+
* single byte of the address preimage.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PQ_SALT_MAX = 255;
|
|
7
17
|
/**
|
|
8
18
|
* Represents an Algorand address
|
|
9
19
|
*/
|
|
@@ -64,3 +74,30 @@ export declare function encodeAddress(address: Uint8Array): string;
|
|
|
64
74
|
* @returns The address corresponding to that application's escrow account.
|
|
65
75
|
*/
|
|
66
76
|
export declare function getApplicationAddress(appID: number | bigint): Address;
|
|
77
|
+
/**
|
|
78
|
+
* Derive a post-quantum (PQ) account address together with the canonical salt
|
|
79
|
+
* used to derive it.
|
|
80
|
+
*
|
|
81
|
+
* @param schemeBytes - The 2-byte ASCII PQ scheme identifier (e.g. "f1" for Falcon-1024).
|
|
82
|
+
* @param key - The scheme's canonical public key.
|
|
83
|
+
* @returns The derived Address and the canonical 1-byte salt.
|
|
84
|
+
*/
|
|
85
|
+
export declare function addressFromPQKey(schemeBytes: Uint8Array, key: Uint8Array): {
|
|
86
|
+
address: Address;
|
|
87
|
+
salt: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Derive the account address that a post-quantum signature authorizes.
|
|
91
|
+
*
|
|
92
|
+
* Unlike an Ed25519 signature, a PQ signature carries the scheme, salt and
|
|
93
|
+
* public key of the signing account, so the address it authorizes is fully
|
|
94
|
+
* determined by the signature and does not have to be supplied out of band.
|
|
95
|
+
*
|
|
96
|
+
* This also validates the signature's self-consistency: the salt must be the
|
|
97
|
+
* canonical one for the given scheme and public key, which is what the network
|
|
98
|
+
* requires.
|
|
99
|
+
*
|
|
100
|
+
* @param pqsig - The post-quantum signature to derive the address from.
|
|
101
|
+
* @returns The address of the account the signature authorizes.
|
|
102
|
+
*/
|
|
103
|
+
export declare function addressFromPQSig(pqsig: EncodedPQSig): Address;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Address } from './encoding/address.js';
|
|
2
|
+
import { AddressWithDelegatedLsigSigner, AddressWithEmptyTransactionSigner, AddressWithTransactionSigner } from './signer.js';
|
|
3
|
+
/**
|
|
4
|
+
* The 2-byte ASCII identifier of the Falcon-1024 post-quantum signature scheme.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FALCON_1024_SCHEME: Uint8Array;
|
|
7
|
+
export interface Falcon1024SigningKey {
|
|
8
|
+
falcon1024PublicKey: Uint8Array;
|
|
9
|
+
falcon1024Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
10
|
+
}
|
|
11
|
+
export declare function addressWithSignersFromRawFalcon1024Signer(falconSigningKey: Falcon1024SigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithEmptyTransactionSigner;
|
|
@@ -26,12 +26,14 @@ export declare class Heartbeat implements Encodable {
|
|
|
26
26
|
seed: Uint8Array;
|
|
27
27
|
voteID: Uint8Array;
|
|
28
28
|
keyDilution: bigint;
|
|
29
|
+
challengeDiscount: boolean;
|
|
29
30
|
constructor(params: {
|
|
30
31
|
address: Address;
|
|
31
32
|
proof: HeartbeatProof;
|
|
32
33
|
seed: Uint8Array;
|
|
33
34
|
voteID: Uint8Array;
|
|
34
35
|
keyDilution: bigint;
|
|
36
|
+
challengeDiscount?: boolean;
|
|
35
37
|
});
|
|
36
38
|
getEncodingSchema(): Schema;
|
|
37
39
|
toEncodingData(): Map<string, unknown>;
|
package/dist/types/logicsig.d.ts
CHANGED
|
@@ -2,13 +2,17 @@ import { Address } from './encoding/address.js';
|
|
|
2
2
|
import * as encoding from './encoding/encoding.js';
|
|
3
3
|
import { NamedMapSchema } from './encoding/schema/index.js';
|
|
4
4
|
import { MultisigMetadata } from './multisig.js';
|
|
5
|
-
import { EncodedMultisig } from './types/transactions/encoded.js';
|
|
5
|
+
import { EncodedMultisig, EncodedPQSig } from './types/transactions/encoded.js';
|
|
6
|
+
import type { DelegatedLsigSigner, ProgramDataSigner } from './signer.js';
|
|
6
7
|
/** sanityCheckProgram performs heuristic program validation:
|
|
7
8
|
* check if passed in bytes are Algorand address or is B64 encoded, rather than Teal bytes
|
|
8
9
|
*
|
|
9
10
|
* @param program - Program bytes to check
|
|
10
11
|
*/
|
|
11
12
|
export declare function sanityCheckProgram(program: Uint8Array): void;
|
|
13
|
+
export declare const PROGRAM_TAG: Uint8Array;
|
|
14
|
+
export declare const PQ_PROGRAM_TAG: Uint8Array;
|
|
15
|
+
export declare const MSIG_PROGRAM_TAG: Uint8Array;
|
|
12
16
|
/**
|
|
13
17
|
LogicSig implementation
|
|
14
18
|
|
|
@@ -21,11 +25,15 @@ export declare class LogicSig implements encoding.Encodable {
|
|
|
21
25
|
sig?: Uint8Array;
|
|
22
26
|
msig?: EncodedMultisig;
|
|
23
27
|
lmsig?: EncodedMultisig;
|
|
28
|
+
pqsig?: EncodedPQSig;
|
|
24
29
|
constructor(program: Uint8Array, programArgs?: Array<Uint8Array> | null);
|
|
25
30
|
getEncodingSchema(): encoding.Schema;
|
|
26
31
|
toEncodingData(): Map<string, unknown>;
|
|
27
32
|
static fromEncodingData(data: unknown): LogicSig;
|
|
28
33
|
/**
|
|
34
|
+
* @deprecated This function does not perform full verification and should not be fully trusted on its own.
|
|
35
|
+
* For example, it does not evaluate programs and does not have the ability to validate PQ signatures.
|
|
36
|
+
*
|
|
29
37
|
* Performs signature verification
|
|
30
38
|
* @param publicKey - Verification key (derived from sender address or escrow address)
|
|
31
39
|
*/
|
|
@@ -36,21 +44,64 @@ export declare class LogicSig implements encoding.Encodable {
|
|
|
36
44
|
*/
|
|
37
45
|
address(): Address;
|
|
38
46
|
/**
|
|
47
|
+
* @deprecated Use `signWithSigner` instead
|
|
48
|
+
*
|
|
39
49
|
* Creates signature (if no msig provided) or multi signature otherwise
|
|
40
50
|
* @param secretKey - Secret key to sign with
|
|
41
51
|
* @param msig - Multisig account as \{version, threshold, addrs\}
|
|
42
52
|
*/
|
|
43
53
|
sign(secretKey: Uint8Array, msig?: MultisigMetadata): void;
|
|
44
54
|
/**
|
|
55
|
+
* Signs this LogicSig for delegation using the given signer.
|
|
56
|
+
*
|
|
57
|
+
* @param signer - The signer to delegate to
|
|
58
|
+
* @param msig - Optional multisig account the signer is a subsigner of
|
|
59
|
+
* @returns The address the signer signed as. When `msig` is omitted this is
|
|
60
|
+
* the delegating account. When `msig` is given it is the individual
|
|
61
|
+
* subsigner, not the multisig, so the delegating account is
|
|
62
|
+
* `multisigAddress(msig)`. Either way it is an authorizing address, which
|
|
63
|
+
* is not necessarily the address a signer sends transactions from.
|
|
64
|
+
*
|
|
65
|
+
* Re-signing an already-signed LogicSig is allowed, and replaces the previous
|
|
66
|
+
* delegation signature. At most one of `sig`, `msig`, `lmsig` and `pqsig` may
|
|
67
|
+
* be set, so any signature left over from an earlier call is cleared.
|
|
68
|
+
*/
|
|
69
|
+
signWithSigner(signer: DelegatedLsigSigner, msig?: MultisigMetadata): Promise<Address>;
|
|
70
|
+
/**
|
|
71
|
+
* Removes every delegation signature from this LogicSig, so that exactly one
|
|
72
|
+
* of them can be set afterwards.
|
|
73
|
+
*/
|
|
74
|
+
private clearSignatures;
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Use `appendToMultisigWithSigner` instead
|
|
77
|
+
*
|
|
45
78
|
* Appends a signature to multi signature
|
|
46
79
|
* @param secretKey - Secret key to sign with
|
|
47
80
|
*/
|
|
48
81
|
appendToMultisig(secretKey: Uint8Array): void;
|
|
82
|
+
appendToMultisigWithSigner(signer: DelegatedLsigSigner): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated Use `signWithSigner` followed by `.sig` instead
|
|
85
|
+
*/
|
|
49
86
|
signProgram(secretKey: Uint8Array): Uint8Array;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated Use `signWithSigner` followed by `.sig` instead
|
|
89
|
+
*/
|
|
50
90
|
signProgramMultisig(secretKey: Uint8Array, msig: EncodedMultisig): Uint8Array;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Use `signWithSigner` followed by `.sig` instead
|
|
93
|
+
*/
|
|
51
94
|
singleSignMultisig(secretKey: Uint8Array, msig: EncodedMultisig): [sig: Uint8Array, index: number];
|
|
52
95
|
toByte(): Uint8Array;
|
|
53
96
|
static fromByte(encoded: ArrayLike<any>): LogicSig;
|
|
97
|
+
/**
|
|
98
|
+
* Signs arbitrary data for use with the `ed25519verify` opcode from within
|
|
99
|
+
* this LogicSig's program.
|
|
100
|
+
*
|
|
101
|
+
* @param signer - The signer to sign the data with
|
|
102
|
+
* @param data - The data to sign
|
|
103
|
+
*/
|
|
104
|
+
signDataWithSigner(signer: ProgramDataSigner, data: Uint8Array): Promise<Uint8Array>;
|
|
54
105
|
}
|
|
55
106
|
/**
|
|
56
107
|
* Represents an account that can sign with a LogicSig program.
|
|
@@ -90,6 +141,9 @@ export declare class LogicSigAccount implements encoding.Encodable {
|
|
|
90
141
|
*/
|
|
91
142
|
isDelegated(): boolean;
|
|
92
143
|
/**
|
|
144
|
+
* @deprecated This function does not perform full verification and should not be fully trusted on its own.
|
|
145
|
+
* For example, it does not evaluate programs and does not have the ability to validate PQ signatures.
|
|
146
|
+
*
|
|
93
147
|
* Verifies this LogicSig's program and signatures.
|
|
94
148
|
* @returns true if and only if the LogicSig program and signatures are valid.
|
|
95
149
|
*/
|
|
@@ -105,6 +159,8 @@ export declare class LogicSigAccount implements encoding.Encodable {
|
|
|
105
159
|
*/
|
|
106
160
|
address(): Address;
|
|
107
161
|
/**
|
|
162
|
+
* @deprecated Use `signMultisigWithSigner` instead
|
|
163
|
+
*
|
|
108
164
|
* Turns this LogicSigAccount into a delegated LogicSig. This type of LogicSig
|
|
109
165
|
* has the authority to sign transactions on behalf of another account, called
|
|
110
166
|
* the delegating account. Use this function if the delegating account is a
|
|
@@ -116,7 +172,10 @@ export declare class LogicSigAccount implements encoding.Encodable {
|
|
|
116
172
|
* from other members.
|
|
117
173
|
*/
|
|
118
174
|
signMultisig(msig: MultisigMetadata, secretKey: Uint8Array): void;
|
|
175
|
+
signMultisigWithSigner(msig: MultisigMetadata, signer: DelegatedLsigSigner): Promise<void>;
|
|
119
176
|
/**
|
|
177
|
+
* @deprecated Use appendToMultisigWithSigner
|
|
178
|
+
*
|
|
120
179
|
* Adds an additional signature from a member of the delegating multisig
|
|
121
180
|
* account.
|
|
122
181
|
*
|
|
@@ -124,7 +183,10 @@ export declare class LogicSigAccount implements encoding.Encodable {
|
|
|
124
183
|
* multisig account.
|
|
125
184
|
*/
|
|
126
185
|
appendToMultisig(secretKey: Uint8Array): void;
|
|
186
|
+
appendToMultisigWithSigner(signer: DelegatedLsigSigner): Promise<void>;
|
|
127
187
|
/**
|
|
188
|
+
* @deprecated Use `signWithSigner` instead
|
|
189
|
+
*
|
|
128
190
|
* Turns this LogicSigAccount into a delegated LogicSig. This type of LogicSig
|
|
129
191
|
* has the authority to sign transactions on behalf of another account, called
|
|
130
192
|
* the delegating account. If the delegating account is a multisig account,
|
|
@@ -133,12 +195,21 @@ export declare class LogicSigAccount implements encoding.Encodable {
|
|
|
133
195
|
* @param secretKey - The secret key of the delegating account.
|
|
134
196
|
*/
|
|
135
197
|
sign(secretKey: Uint8Array): void;
|
|
198
|
+
/**
|
|
199
|
+
* Turns this LogicSigAccount into a delegated LogicSig, signed by the given
|
|
200
|
+
* signer. If the delegating account is a multisig account, use
|
|
201
|
+
* `signMultisigWithSigner` instead.
|
|
202
|
+
*
|
|
203
|
+
* @param signer - The signer of the delegating account.
|
|
204
|
+
*/
|
|
205
|
+
signWithSigner(signer: DelegatedLsigSigner): Promise<void>;
|
|
136
206
|
}
|
|
137
207
|
/**
|
|
138
208
|
* logicSigFromByte accepts encoded logic sig bytes and attempts to call logicsig.fromByte on it,
|
|
139
209
|
* returning the result
|
|
140
210
|
*/
|
|
141
211
|
export declare function logicSigFromByte(encoded: Uint8Array): LogicSig;
|
|
212
|
+
export declare const SIGN_PROGRAM_DATA_PREFIX: Uint8Array;
|
|
142
213
|
/**
|
|
143
214
|
* tealSign creates a signature compatible with ed25519verify opcode from program hash
|
|
144
215
|
* @param sk - Uint8Array with secret key
|
package/dist/types/main.d.ts
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
|
-
import { Address } from './encoding/address.js';
|
|
2
|
-
import { Transaction } from './transaction.js';
|
|
3
1
|
export declare const MULTISIG_BAD_SENDER_ERROR_MSG = "The transaction sender address and multisig preimage do not match.";
|
|
4
|
-
/**
|
|
5
|
-
* signTransaction takes an object with either payment or key registration fields and
|
|
6
|
-
* a secret key and returns a signed blob.
|
|
7
|
-
*
|
|
8
|
-
* Payment transaction fields: from, to, amount, fee, firstValid, lastValid, genesisHash,
|
|
9
|
-
* note(optional), GenesisID(optional), closeRemainderTo(optional)
|
|
10
|
-
*
|
|
11
|
-
* Key registration fields: fee, firstValid, lastValid, voteKey, selectionKey, voteFirst,
|
|
12
|
-
* voteLast, voteKeyDilution, genesisHash, note(optional), GenesisID(optional)
|
|
13
|
-
*
|
|
14
|
-
* If flatFee is not set and the final calculated fee is lower than the protocol minimum fee, the fee will be increased to match the minimum.
|
|
15
|
-
* @param txn - object with either payment or key registration fields
|
|
16
|
-
* @param sk - Algorand Secret Key
|
|
17
|
-
* @returns object contains the binary signed transaction and its txID
|
|
18
|
-
*/
|
|
19
|
-
export declare function signTransaction(txn: Transaction, sk: Uint8Array): {
|
|
20
|
-
txID: string;
|
|
21
|
-
blob: Uint8Array;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* signBytes takes arbitrary bytes and a secret key, prepends the bytes with "MX" for domain separation, signs the bytes
|
|
25
|
-
* with the private key, and returns the signature.
|
|
26
|
-
* @param bytes - Uint8array
|
|
27
|
-
* @param sk - Algorand secret key
|
|
28
|
-
* @returns binary signature
|
|
29
|
-
*/
|
|
30
|
-
export declare function signBytes(bytes: Uint8Array, sk: Uint8Array): Uint8Array;
|
|
31
|
-
/**
|
|
32
|
-
* verifyBytes takes array of bytes, an address, and a signature and verifies if the signature is correct for the public
|
|
33
|
-
* key and the bytes (the bytes should have been signed with "MX" prepended for domain separation).
|
|
34
|
-
* @param bytes - Uint8Array
|
|
35
|
-
* @param signature - binary signature
|
|
36
|
-
* @param addr - string address
|
|
37
|
-
* @returns bool
|
|
38
|
-
*/
|
|
39
|
-
export declare function verifyBytes(bytes: Uint8Array, signature: Uint8Array, addr: string | Address): boolean;
|
|
40
2
|
export declare const ERROR_MULTISIG_BAD_SENDER: Error;
|
|
41
3
|
export declare const ERROR_INVALID_MICROALGOS: Error;
|
|
42
4
|
export { AlgodClient as Algodv2 } from './client/v2/algod/algod.js';
|
|
@@ -48,7 +10,7 @@ export { BaseHTTPClient, BaseHTTPClientResponse, BaseHTTPClientError, } from './
|
|
|
48
10
|
export { AlgodTokenHeader, IndexerTokenHeader, KMDTokenHeader, CustomTokenHeader, TokenHeader, } from './client/urlTokenBaseHTTPClient.js';
|
|
49
11
|
export { waitForConfirmation } from './wait.js';
|
|
50
12
|
export { MsgpackEncodingData, JSONEncodingData, Encodable, EncodableClass, encodeObj, decodeObj, msgpackRawEncode, msgpackRawDecode, msgpackRawDecodeAsMap, encodeMsgpack, decodeMsgpack, encodeJSON, decodeJSON, } from './encoding/encoding.js';
|
|
51
|
-
export { Address, isValidAddress, encodeAddress, decodeAddress, getApplicationAddress, ALGORAND_ZERO_ADDRESS_STRING, } from './encoding/address.js';
|
|
13
|
+
export { Address, isValidAddress, encodeAddress, decodeAddress, getApplicationAddress, addressFromPQKey, addressFromPQSig, PQ_SCHEME_SIZE, PQ_SALT_MAX, ALGORAND_ZERO_ADDRESS_STRING, } from './encoding/address.js';
|
|
52
14
|
export { bytesToBigInt, bigIntToBytes } from './encoding/bigint.js';
|
|
53
15
|
export { base64ToBytes, bytesToBase64, bytesToString, coerceToBytes, bytesToHex, hexToBytes, } from './encoding/binarydata.js';
|
|
54
16
|
export { encodeUint64, decodeUint64 } from './encoding/uint64.js';
|
|
@@ -60,16 +22,18 @@ export * from './stateproof.js';
|
|
|
60
22
|
export { UntypedValue } from './client/v2/untypedmodel.js';
|
|
61
23
|
export * as modelsv2 from './client/v2/algod/models/types.js';
|
|
62
24
|
export * as indexerModels from './client/v2/indexer/models/types.js';
|
|
63
|
-
export { mnemonicToMasterDerivationKey, masterDerivationKeyToMnemonic, secretKeyToMnemonic, mnemonicToSecretKey, seedFromMnemonic, mnemonicFromSeed, } from './mnemonic/mnemonic.js';
|
|
25
|
+
export { mnemonicToMasterDerivationKey, masterDerivationKeyToMnemonic, secretKeyToMnemonic, mnemonicToSecretKey, seedFromMnemonic, mnemonicFromSeed, pq25WordMnemonicToSeed, } from './mnemonic/mnemonic.js';
|
|
64
26
|
export { microalgosToAlgos, algosToMicroalgos, INVALID_MICROALGOS_ERROR_MSG, } from './convert.js';
|
|
65
27
|
export { computeGroupID, assignGroupID } from './group.js';
|
|
66
28
|
export { SignedTransaction, decodeSignedTransaction, encodeUnsignedSimulateTransaction, } from './signedTransaction.js';
|
|
67
|
-
export { signLogicSigTransaction, signLogicSigTransactionObject, } from './signing.js';
|
|
68
|
-
export { LogicSig, LogicSigAccount, logicSigFromByte, tealSign, tealSignFromProgram, verifyTealSign, } from './logicsig.js';
|
|
29
|
+
export { SIGN_BYTES_PREFIX, signTransaction, signTransactionWithSigner, signBytes, verifyBytes, signLogicSigTransaction, signLogicSigTransactionObject, } from './signing.js';
|
|
30
|
+
export { LogicSig, LogicSigAccount, logicSigFromByte, tealSign, tealSignFromProgram, verifyTealSign, PROGRAM_TAG, PQ_PROGRAM_TAG, MSIG_PROGRAM_TAG, SIGN_PROGRAM_DATA_PREFIX, } from './logicsig.js';
|
|
69
31
|
export { MultisigMetadata, verifyMultisig, multisigAddress, } from './multisig.js';
|
|
70
|
-
export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, createMultisigTransaction, appendSignRawMultisigSignature, } from './multisigSigning.js';
|
|
32
|
+
export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, createMultisigTransaction, appendSignRawMultisigSignature, signMultisigTransactionWithSigner, appendSignMultisigTransactionWithSigner, } from './multisigSigning.js';
|
|
71
33
|
export { ProgramSourceMap, SourceLocation, PcLineLocation, } from './logic/sourcemap.js';
|
|
72
|
-
export
|
|
34
|
+
export { Ed25519SigningKey, addressWithSignersFromRawEd25519Signer, } from './ed25519-signer.js';
|
|
35
|
+
export { FALCON_1024_SCHEME, Falcon1024SigningKey, addressWithSignersFromRawFalcon1024Signer, } from './falcon-signer.js';
|
|
36
|
+
export { PQSigningKey, addressWithSignersFromRawPQSigner, } from './pq-signer.js';
|
|
73
37
|
export * from './makeTxn.js';
|
|
74
38
|
export * from './transaction.js';
|
|
75
39
|
export * from './signer.js';
|
package/dist/types/makeTxn.d.ts
CHANGED
|
@@ -128,11 +128,17 @@ export declare function makeApplicationCallTxnFromObject({ sender, appIndex, onC
|
|
|
128
128
|
*/
|
|
129
129
|
export declare function makeApplicationCreateTxnFromObject({ sender, onComplete, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, numLocalInts, numLocalByteSlices, numGlobalInts, numGlobalByteSlices, extraPages, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'appIndex' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
|
|
130
130
|
/**
|
|
131
|
-
* Make a transaction that changes an application's approval and clear programs
|
|
131
|
+
* Make a transaction that changes an application's approval and clear programs.
|
|
132
|
+
*
|
|
133
|
+
* The application's global state schema and extra program pages may also be changed during an
|
|
134
|
+
* update by providing numGlobalInts, numGlobalByteSlices, and/or extraPages. The local state schema
|
|
135
|
+
* cannot be changed after application creation. If the pages or global schema increases in size, the entire
|
|
136
|
+
* MBR for the application will move to the sender of the update and that account will become the `sizeSponsor`
|
|
137
|
+
* in the application's parameters. A decrease in schema or pages does not affect MBR or `sizeSponsor`.
|
|
132
138
|
*
|
|
133
139
|
* @param options - Application update transaction parameters
|
|
134
140
|
*/
|
|
135
|
-
export declare function makeApplicationUpdateTxnFromObject({ sender, appIndex, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'onComplete' | 'numLocalInts' | 'numLocalByteSlices' | '
|
|
141
|
+
export declare function makeApplicationUpdateTxnFromObject({ sender, appIndex, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, extraPages, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'onComplete' | 'numLocalInts' | 'numLocalByteSlices' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
|
|
136
142
|
/**
|
|
137
143
|
* Make a transaction that deletes an application
|
|
138
144
|
*
|
|
@@ -41,3 +41,16 @@ export declare function mnemonicToMasterDerivationKey(mn: string): Uint8Array;
|
|
|
41
41
|
* @returns string mnemonic
|
|
42
42
|
*/
|
|
43
43
|
export declare function masterDerivationKeyToMnemonic(mdk: Uint8Array): string;
|
|
44
|
+
/**
|
|
45
|
+
* pq25WordMnemonicToSeed derives a post-quantum key seed from a standard 25-word
|
|
46
|
+
* Algorand mnemonic.
|
|
47
|
+
*
|
|
48
|
+
* The seed is domain-separated by the PQ scheme, so the same mnemonic yields a
|
|
49
|
+
* different key for each scheme, and a different key again from the ed25519
|
|
50
|
+
* account that `mnemonicToSecretKey` derives from it.
|
|
51
|
+
*
|
|
52
|
+
* @param mn - A 25-word Algorand mnemonic
|
|
53
|
+
* @param scheme - The 2-byte ASCII PQ scheme identifier (e.g. "f1" for Falcon-1024)
|
|
54
|
+
* @returns The 32-byte seed to hand to the scheme's key generator
|
|
55
|
+
*/
|
|
56
|
+
export declare function pq25WordMnemonicToSeed(mn: string, scheme: Uint8Array): Uint8Array;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Address } from './encoding/address.js';
|
|
2
2
|
import { Transaction } from './transaction.js';
|
|
3
3
|
import { MultisigMetadata } from './multisig.js';
|
|
4
|
+
import type { TransactionSigner } from './signer.js';
|
|
4
5
|
export declare const MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG = "Not enough multisig transactions to merge. Need at least two";
|
|
5
6
|
export declare const MULTISIG_MERGE_MISMATCH_ERROR_MSG = "Cannot merge txs. txIDs differ";
|
|
6
7
|
export declare const MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG = "Cannot merge txs. Auth addrs differ";
|
|
@@ -25,6 +26,8 @@ export declare function createMultisigTransaction(txn: Transaction, { version, t
|
|
|
25
26
|
*/
|
|
26
27
|
export declare function mergeMultisigTransactions(multisigTxnBlobs: Uint8Array[]): Uint8Array;
|
|
27
28
|
/**
|
|
29
|
+
* @deprecated Use {@link signMultisigTransactionWithSigner} instead
|
|
30
|
+
*
|
|
28
31
|
* signMultisigTransaction takes a raw transaction (see signTransaction), a multisig preimage, a secret key, and returns
|
|
29
32
|
* a multisig transaction, which is a blob representing a transaction and multisignature account preimage. The returned
|
|
30
33
|
* multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendSignMultisigTransaction.
|
|
@@ -41,6 +44,31 @@ export declare function signMultisigTransaction(txn: Transaction, { version, thr
|
|
|
41
44
|
blob: Uint8Array;
|
|
42
45
|
};
|
|
43
46
|
/**
|
|
47
|
+
* signMultisigTransactionWithSigner takes a raw transaction, a multisig preimage and a signer, and
|
|
48
|
+
* returns a multisig transaction: a blob representing a transaction and multisignature account
|
|
49
|
+
* preimage. The returned multisig txn can accumulate additional signatures through
|
|
50
|
+
* mergeMultisigTransactions or appendSignMultisigTransactionWithSigner.
|
|
51
|
+
*
|
|
52
|
+
* The signer must hold a key belonging to the multisig. That key is taken from the `sgnr` field of
|
|
53
|
+
* the transaction the signer returns, falling back to the transaction sender when `sgnr` is absent
|
|
54
|
+
* — which is the same convention signers use when writing it. Every signer this SDK provides
|
|
55
|
+
* follows it. Note that `AddressWithTransactionSigner.address` cannot be used for this: it is the
|
|
56
|
+
* address the signer sends transactions from, which for a rekeyed account is not the signing key.
|
|
57
|
+
*
|
|
58
|
+
* @param txn - the transaction to sign
|
|
59
|
+
* @param version - multisig version
|
|
60
|
+
* @param threshold - multisig threshold
|
|
61
|
+
* @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
|
|
62
|
+
* @param txnSigner - the signer to sign with
|
|
63
|
+
* @returns an object with txID and blob properties
|
|
64
|
+
*/
|
|
65
|
+
export declare function signMultisigTransactionWithSigner(txn: Transaction, { version, threshold, addrs }: MultisigMetadata, txnSigner: TransactionSigner): Promise<{
|
|
66
|
+
txID: string;
|
|
67
|
+
blob: Uint8Array;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated Use {@link appendSignMultisigTransactionWithSigner} instead
|
|
71
|
+
*
|
|
44
72
|
* appendSignMultisigTransaction takes a multisig transaction blob, and appends our signature to it.
|
|
45
73
|
* While we could derive public key preimagery from the partially-signed multisig transaction,
|
|
46
74
|
* we ask the caller to pass it back in, to ensure they know what they are signing.
|
|
@@ -55,6 +83,27 @@ export declare function appendSignMultisigTransaction(multisigTxnBlob: Uint8Arra
|
|
|
55
83
|
txID: string;
|
|
56
84
|
blob: Uint8Array;
|
|
57
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* appendSignMultisigTransactionWithSigner takes a multisig transaction blob, and appends the given
|
|
88
|
+
* signer's signature to it. While we could derive public key preimagery from the partially-signed
|
|
89
|
+
* multisig transaction, we ask the caller to pass it back in, to ensure they know what they are
|
|
90
|
+
* signing.
|
|
91
|
+
*
|
|
92
|
+
* As with {@link signMultisigTransactionWithSigner}, the signer's key is taken from the `sgnr`
|
|
93
|
+
* field of the transaction it returns, falling back to the transaction sender when `sgnr` is
|
|
94
|
+
* absent.
|
|
95
|
+
*
|
|
96
|
+
* @param multisigTxnBlob - an encoded multisig txn. Supports non-payment txn types.
|
|
97
|
+
* @param version - multisig version
|
|
98
|
+
* @param threshold - multisig threshold
|
|
99
|
+
* @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
|
|
100
|
+
* @param txnSigner - the signer to sign with
|
|
101
|
+
* @returns an object with txID and blob properties
|
|
102
|
+
*/
|
|
103
|
+
export declare function appendSignMultisigTransactionWithSigner(multisigTxnBlob: Uint8Array, { version, threshold, addrs }: MultisigMetadata, txnSigner: TransactionSigner): Promise<{
|
|
104
|
+
txID: string;
|
|
105
|
+
blob: Uint8Array;
|
|
106
|
+
}>;
|
|
58
107
|
/**
|
|
59
108
|
* appendMultisigTransactionSignature takes a multisig transaction blob, and appends a given raw signature to it.
|
|
60
109
|
* This makes it possible to compile a multisig signature using only raw signatures from external methods.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Address } from './encoding/address.js';
|
|
2
|
+
import { AddressWithDelegatedLsigSigner, AddressWithEmptyTransactionSigner, AddressWithTransactionSigner } from './signer.js';
|
|
3
|
+
export interface PQSigningKey {
|
|
4
|
+
pqScheme: Uint8Array;
|
|
5
|
+
pqPublicKey: Uint8Array;
|
|
6
|
+
pqSigner: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
7
|
+
}
|
|
8
|
+
export declare function addressWithSignersFromRawPQSigner(signingKey: PQSigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithEmptyTransactionSigner;
|
|
@@ -2,7 +2,7 @@ import { Encodable } from './encoding/encoding.js';
|
|
|
2
2
|
import { Address } from './encoding/address.js';
|
|
3
3
|
import { Transaction } from './transaction.js';
|
|
4
4
|
import { LogicSig } from './logicsig.js';
|
|
5
|
-
import { EncodedMultisig } from './types/transactions/index.js';
|
|
5
|
+
import { EncodedMultisig, EncodedPQSig } from './types/transactions/index.js';
|
|
6
6
|
import { NamedMapSchema } from './encoding/schema/index.js';
|
|
7
7
|
export declare class SignedTransaction implements Encodable {
|
|
8
8
|
static readonly encodingSchema: NamedMapSchema;
|
|
@@ -22,15 +22,20 @@ export declare class SignedTransaction implements Encodable {
|
|
|
22
22
|
* Logic signature
|
|
23
23
|
*/
|
|
24
24
|
readonly lsig?: LogicSig;
|
|
25
|
+
/**
|
|
26
|
+
* Post-quantum signature
|
|
27
|
+
*/
|
|
28
|
+
readonly pqsig?: EncodedPQSig;
|
|
25
29
|
/**
|
|
26
30
|
* The signer, if signing with a different key than the Transaction type `sender` property indicates
|
|
27
31
|
*/
|
|
28
32
|
readonly sgnr?: Address;
|
|
29
|
-
constructor({ txn, sig, msig, lsig, sgnr, }: {
|
|
33
|
+
constructor({ txn, sig, msig, lsig, pqsig, sgnr, }: {
|
|
30
34
|
txn: Transaction;
|
|
31
35
|
sig?: Uint8Array;
|
|
32
36
|
msig?: EncodedMultisig;
|
|
33
37
|
lsig?: LogicSig;
|
|
38
|
+
pqsig?: EncodedPQSig;
|
|
34
39
|
sgnr?: Address;
|
|
35
40
|
});
|
|
36
41
|
getEncodingSchema(): NamedMapSchema;
|
package/dist/types/signer.d.ts
CHANGED
|
@@ -2,6 +2,16 @@ import Account from './types/account.js';
|
|
|
2
2
|
import { Transaction } from './transaction.js';
|
|
3
3
|
import { LogicSigAccount } from './logicsig.js';
|
|
4
4
|
import { MultisigMetadata } from './multisig.js';
|
|
5
|
+
import type { Address } from './encoding/address.js';
|
|
6
|
+
import type { EncodedMultisig, EncodedPQSig } from './types/transactions/encoded.js';
|
|
7
|
+
import type { LogicSig } from './logicsig.js';
|
|
8
|
+
/**
|
|
9
|
+
* Something that has an Algorand address associated with it.
|
|
10
|
+
* It could be logic sig, single-signer account, multisig, app, etc.
|
|
11
|
+
*/
|
|
12
|
+
export interface Addressable {
|
|
13
|
+
address: Address;
|
|
14
|
+
}
|
|
5
15
|
/**
|
|
6
16
|
* This type represents a function which can sign transactions from an atomic transaction group.
|
|
7
17
|
* @param txnGroup - The atomic group containing transactions to be signed
|
|
@@ -11,6 +21,42 @@ import { MultisigMetadata } from './multisig.js';
|
|
|
11
21
|
* corresponds to the signed transaction from txnGroup[indexesToSign[i]]
|
|
12
22
|
*/
|
|
13
23
|
export type TransactionSigner = (txnGroup: Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
24
|
+
export interface AddressWithTransactionSigner extends Addressable {
|
|
25
|
+
txnSigner: TransactionSigner;
|
|
26
|
+
}
|
|
27
|
+
export interface AddressWithEmptyTransactionSigner extends Addressable {
|
|
28
|
+
/**
|
|
29
|
+
* A TransactionSigner that produces unsigned (or placeholder-signed)
|
|
30
|
+
* transactions. This must only be used to simulate transactions with the
|
|
31
|
+
* `allowEmptySignatures` option enabled.
|
|
32
|
+
*/
|
|
33
|
+
emptyTxnSigner: TransactionSigner;
|
|
34
|
+
}
|
|
35
|
+
/** Function for signing logic signatures for delegation
|
|
36
|
+
* @param lsig - The logic signature that is being signed for delegation
|
|
37
|
+
* @param msig - Optional multisig account that should be set when a public key is signing as a subsigner of a multisig
|
|
38
|
+
* @returns The address of the delegator
|
|
39
|
+
* */
|
|
40
|
+
export type DelegatedLsigSigner = (lsig: LogicSig, msig?: MultisigMetadata) => Promise<{
|
|
41
|
+
address: Address;
|
|
42
|
+
} & ({
|
|
43
|
+
sig: Uint8Array;
|
|
44
|
+
} | {
|
|
45
|
+
lmsig: EncodedMultisig;
|
|
46
|
+
} | {
|
|
47
|
+
pqsig: EncodedPQSig;
|
|
48
|
+
})>;
|
|
49
|
+
export interface AddressWithDelegatedLsigSigner extends Addressable {
|
|
50
|
+
delegatedLsigSigner: DelegatedLsigSigner;
|
|
51
|
+
}
|
|
52
|
+
export type MxBytesSigner = (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
53
|
+
export interface AddressWithMxBytesSigner extends Addressable {
|
|
54
|
+
mxBytesSigner: MxBytesSigner;
|
|
55
|
+
}
|
|
56
|
+
export type ProgramDataSigner = (data: Uint8Array, lsig: LogicSig) => Promise<Uint8Array>;
|
|
57
|
+
export interface AddressWithProgramDataSigner extends Addressable {
|
|
58
|
+
programDataSigner: ProgramDataSigner;
|
|
59
|
+
}
|
|
14
60
|
/**
|
|
15
61
|
* Create a TransactionSigner that can sign transactions for the provided basic Account.
|
|
16
62
|
*/
|
package/dist/types/signing.d.ts
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
|
+
import { Address } from './encoding/address.js';
|
|
2
|
+
import { SignedTransaction } from './signedTransaction.js';
|
|
1
3
|
import { Transaction } from './transaction.js';
|
|
2
4
|
import { LogicSig, LogicSigAccount } from './logicsig.js';
|
|
5
|
+
import type { TransactionSigner } from './signer.js';
|
|
6
|
+
export declare const SIGN_BYTES_PREFIX: Uint8Array;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use signTransactionWithSigner
|
|
9
|
+
*
|
|
10
|
+
* signTransaction takes an object with either payment or key registration fields and
|
|
11
|
+
* a secret key and returns a signed blob.
|
|
12
|
+
*
|
|
13
|
+
* Payment transaction fields: from, to, amount, fee, firstValid, lastValid, genesisHash,
|
|
14
|
+
* note(optional), GenesisID(optional), closeRemainderTo(optional)
|
|
15
|
+
*
|
|
16
|
+
* Key registration fields: fee, firstValid, lastValid, voteKey, selectionKey, voteFirst,
|
|
17
|
+
* voteLast, voteKeyDilution, genesisHash, note(optional), GenesisID(optional)
|
|
18
|
+
*
|
|
19
|
+
* If flatFee is not set and the final calculated fee is lower than the protocol minimum fee, the fee will be increased to match the minimum.
|
|
20
|
+
* @param txn - object with either payment or key registration fields
|
|
21
|
+
* @param sk - Algorand Secret Key
|
|
22
|
+
* @returns object contains the binary signed transaction and its txID
|
|
23
|
+
*/
|
|
24
|
+
export declare function signTransaction(txn: Transaction, sk: Uint8Array): {
|
|
25
|
+
txID: string;
|
|
26
|
+
blob: Uint8Array;
|
|
27
|
+
};
|
|
28
|
+
export declare function signTransactionWithSigner(txn: Transaction, signer: TransactionSigner): Promise<ReturnType<typeof signTransaction> & {
|
|
29
|
+
stxn: SignedTransaction;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* signBytes takes arbitrary bytes and a secret key, prepends the bytes with "MX" for domain separation, signs the bytes
|
|
33
|
+
* with the private key, and returns the signature.
|
|
34
|
+
* @param bytes - Uint8array
|
|
35
|
+
* @param sk - Algorand secret key
|
|
36
|
+
* @returns binary signature
|
|
37
|
+
*/
|
|
38
|
+
export declare function signBytes(bytes: Uint8Array, sk: Uint8Array): Uint8Array;
|
|
39
|
+
/**
|
|
40
|
+
* verifyBytes takes array of bytes, an address, and a signature and verifies if the signature is correct for the public
|
|
41
|
+
* key and the bytes (the bytes should have been signed with "MX" prepended for domain separation).
|
|
42
|
+
* @param bytes - Uint8Array
|
|
43
|
+
* @param signature - binary signature
|
|
44
|
+
* @param addr - string address
|
|
45
|
+
* @returns bool
|
|
46
|
+
*/
|
|
47
|
+
export declare function verifyBytes(bytes: Uint8Array, signature: Uint8Array, addr: string | Address): boolean;
|
|
3
48
|
/**
|
|
4
49
|
* signLogicSigTransactionObject takes a transaction and a LogicSig object and
|
|
5
50
|
* returns a signed transaction.
|
|
@@ -93,6 +93,7 @@ export interface HeartbeatTransactionFields {
|
|
|
93
93
|
readonly seed: Uint8Array;
|
|
94
94
|
readonly voteID: Uint8Array;
|
|
95
95
|
readonly keyDilution: bigint;
|
|
96
|
+
readonly challengeDiscount: boolean;
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
98
99
|
* Transaction enables construction of Algorand transactions
|
|
@@ -129,7 +130,16 @@ export declare class Transaction implements encoding.Encodable {
|
|
|
129
130
|
private estimateSize;
|
|
130
131
|
bytesToSign(): Uint8Array;
|
|
131
132
|
toByte(): Uint8Array;
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated Use `(await signTransactionWithSigner(txn, signer)).stxn.sig` instead
|
|
135
|
+
*
|
|
136
|
+
* returns the raw signature
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
132
139
|
rawSignTxn(sk: Uint8Array): Uint8Array;
|
|
140
|
+
/**
|
|
141
|
+
* @deprecated Use `await signTransactionWithSigner(txn, signer)`
|
|
142
|
+
*/
|
|
133
143
|
signTxn(sk: Uint8Array): Uint8Array;
|
|
134
144
|
attachSignature(signerAddr: string | Address, signature: Uint8Array): Uint8Array;
|
|
135
145
|
rawTxID(): Uint8Array;
|
|
@@ -48,6 +48,20 @@ export declare class AppParams implements Encodable {
|
|
|
48
48
|
localStateSchema: StateSchema;
|
|
49
49
|
globalStateSchema: StateSchema;
|
|
50
50
|
extraProgramPages: number;
|
|
51
|
+
version: bigint;
|
|
52
|
+
/**
|
|
53
|
+
* If non-zero, the account that must hold MBR for extra program pages and the
|
|
54
|
+
* global schema.
|
|
55
|
+
*/
|
|
56
|
+
sizeSponsor: Address;
|
|
57
|
+
/**
|
|
58
|
+
* When true, any app may read this app's boxes.
|
|
59
|
+
*/
|
|
60
|
+
foreignBoxReads: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* When true, apps with the same creator may read and write this app's boxes.
|
|
63
|
+
*/
|
|
64
|
+
familyBoxAccess: boolean;
|
|
51
65
|
constructor(params: {
|
|
52
66
|
approvalProgram: Uint8Array;
|
|
53
67
|
clearStateProgram: Uint8Array;
|
|
@@ -55,6 +69,10 @@ export declare class AppParams implements Encodable {
|
|
|
55
69
|
localStateSchema: StateSchema;
|
|
56
70
|
globalStateSchema: StateSchema;
|
|
57
71
|
extraProgramPages: number;
|
|
72
|
+
version?: bigint;
|
|
73
|
+
sizeSponsor?: Address;
|
|
74
|
+
foreignBoxReads?: boolean;
|
|
75
|
+
familyBoxAccess?: boolean;
|
|
58
76
|
});
|
|
59
77
|
getEncodingSchema(): Schema;
|
|
60
78
|
toEncodingData(): Map<string, unknown>;
|