@algorandfoundation/algokit-utils 10.0.0-alpha.20 → 10.0.0-alpha.22
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/abi/index.d.ts +2 -1
- package/abi/index.js +3 -0
- package/abi/index.mjs +2 -1
- package/package.json +1 -6
- package/packages/abi/src/abi-type.d.ts +0 -2
- package/packages/abi/src/abi-type.js +3 -34
- package/packages/abi/src/abi-type.js.map +1 -1
- package/packages/abi/src/abi-type.mjs +3 -34
- package/packages/abi/src/abi-type.mjs.map +1 -1
- package/packages/abi/src/utils.d.ts +22 -0
- package/packages/abi/src/utils.js +57 -0
- package/packages/abi/src/utils.js.map +1 -0
- package/packages/abi/src/utils.mjs +55 -0
- package/packages/abi/src/utils.mjs.map +1 -0
- package/packages/algo25/src/index.js +1 -1
- package/packages/algo25/src/index.mjs +1 -1
- package/packages/common/src/json.mjs +2 -2
- package/packages/common/src/json.mjs.map +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.d.ts +2 -2
- package/packages/{sdk/src/logic → common/src}/sourcemap.js +2 -2
- package/packages/{sdk/src/logic → common/src}/sourcemap.js.map +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.mjs +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.mjs.map +1 -1
- package/testing/transaction-logger.js +1 -1
- package/testing/transaction-logger.mjs +1 -1
- package/transactions/app-call.js +1 -1
- package/transactions/app-call.mjs +1 -1
- package/transactions/method-call.js +1 -1
- package/transactions/method-call.mjs +1 -1
- package/types/account-manager.js +3 -3
- package/types/account-manager.mjs +3 -3
- package/types/algorand-client-transaction-creator.d.ts +10 -10
- package/types/algorand-client-transaction-sender.d.ts +10 -10
- package/types/amount.js +23 -4
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +20 -2
- package/types/amount.mjs.map +1 -1
- package/types/app-client.d.ts +11 -11
- package/types/app-client.js +2 -2
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +2 -2
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.js +1 -1
- package/types/app-deployer.mjs +1 -1
- package/types/app-factory.d.ts +8 -8
- package/types/app-factory.js +2 -2
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +2 -2
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.js +1 -1
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +1 -1
- package/types/app-manager.mjs.map +1 -1
- package/types/app.d.ts +1 -1
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/composer.js +20 -20
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +4 -4
- package/types/kmd-account-manager.js +1 -1
- package/types/kmd-account-manager.mjs +1 -1
- package/packages/sdk/src/convert.d.ts +0 -17
- package/packages/sdk/src/convert.js +0 -28
- package/packages/sdk/src/convert.js.map +0 -1
- package/packages/sdk/src/convert.mjs +0 -25
- package/packages/sdk/src/convert.mjs.map +0 -1
- package/packages/sdk/src/encoding/binarydata.d.ts +0 -34
- package/packages/sdk/src/encoding/binarydata.js +0 -65
- package/packages/sdk/src/encoding/binarydata.js.map +0 -1
- package/packages/sdk/src/encoding/binarydata.mjs +0 -60
- package/packages/sdk/src/encoding/binarydata.mjs.map +0 -1
- package/packages/sdk/src/encoding/encoding.d.ts +0 -237
- package/packages/sdk/src/encoding/encoding.js +0 -312
- package/packages/sdk/src/encoding/encoding.js.map +0 -1
- package/packages/sdk/src/encoding/encoding.mjs +0 -298
- package/packages/sdk/src/encoding/encoding.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/array.js +0 -35
- package/packages/sdk/src/encoding/schema/array.js.map +0 -1
- package/packages/sdk/src/encoding/schema/array.mjs +0 -35
- package/packages/sdk/src/encoding/schema/array.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/bytearray.js +0 -49
- package/packages/sdk/src/encoding/schema/bytearray.js.map +0 -1
- package/packages/sdk/src/encoding/schema/bytearray.mjs +0 -49
- package/packages/sdk/src/encoding/schema/bytearray.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/map.d.ts +0 -58
- package/packages/sdk/src/encoding/schema/map.js +0 -108
- package/packages/sdk/src/encoding/schema/map.js.map +0 -1
- package/packages/sdk/src/encoding/schema/map.mjs +0 -107
- package/packages/sdk/src/encoding/schema/map.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/optional.js +0 -46
- package/packages/sdk/src/encoding/schema/optional.js.map +0 -1
- package/packages/sdk/src/encoding/schema/optional.mjs +0 -46
- package/packages/sdk/src/encoding/schema/optional.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/uint64.js +0 -30
- package/packages/sdk/src/encoding/schema/uint64.js.map +0 -1
- package/packages/sdk/src/encoding/schema/uint64.mjs +0 -30
- package/packages/sdk/src/encoding/schema/uint64.mjs.map +0 -1
- package/packages/sdk/src/encoding/uint64.d.ts +0 -34
- package/packages/sdk/src/encoding/uint64.js +0 -34
- package/packages/sdk/src/encoding/uint64.js.map +0 -1
- package/packages/sdk/src/encoding/uint64.mjs +0 -33
- package/packages/sdk/src/encoding/uint64.mjs.map +0 -1
- package/packages/sdk/src/index.d.ts +0 -44
- package/packages/sdk/src/index.js +0 -62
- package/packages/sdk/src/index.js.map +0 -1
- package/packages/sdk/src/index.mjs +0 -58
- package/packages/sdk/src/index.mjs.map +0 -1
- package/packages/sdk/src/nacl/naclWrappers.js +0 -14
- package/packages/sdk/src/nacl/naclWrappers.js.map +0 -1
- package/packages/sdk/src/nacl/naclWrappers.mjs +0 -11
- package/packages/sdk/src/nacl/naclWrappers.mjs.map +0 -1
- package/packages/sdk/src/types/intDecoding.d.ts +0 -28
- package/packages/sdk/src/types/intDecoding.js +0 -32
- package/packages/sdk/src/types/intDecoding.js.map +0 -1
- package/packages/sdk/src/types/intDecoding.mjs +0 -31
- package/packages/sdk/src/types/intDecoding.mjs.map +0 -1
- package/packages/sdk/src/types/transactions/encoded.d.ts +0 -40
- package/packages/sdk/src/types/transactions/encoded.js +0 -64
- package/packages/sdk/src/types/transactions/encoded.js.map +0 -1
- package/packages/sdk/src/types/transactions/encoded.mjs +0 -59
- package/packages/sdk/src/types/transactions/encoded.mjs.map +0 -1
- package/packages/sdk/src/utils/utils.d.ts +0 -64
- package/packages/sdk/src/utils/utils.js +0 -140
- package/packages/sdk/src/utils/utils.js.map +0 -1
- package/packages/sdk/src/utils/utils.mjs +0 -128
- package/packages/sdk/src/utils/utils.mjs.map +0 -1
- package/sdk/index.d.ts +0 -10
- package/sdk/index.js +0 -59
- package/sdk/index.mjs +0 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Address, getAddress, getOptionalAddress } from "../packages/common/src/address.mjs";
|
|
2
|
-
import { generateAddressWithSigners } from "../packages/transact/src/signer.mjs";
|
|
3
|
-
import { LogicSigAccount } from "../packages/transact/src/logicsig.mjs";
|
|
4
|
-
import { MultisigAccount } from "../packages/transact/src/multisig.mjs";
|
|
5
2
|
import { AlgoAmount } from "./amount.mjs";
|
|
6
3
|
import { Config } from "../config.mjs";
|
|
7
4
|
import { calculateFundAmount, memoize } from "../util.mjs";
|
|
8
5
|
import { seedFromMnemonic } from "../packages/algo25/src/index.mjs";
|
|
6
|
+
import { generateAddressWithSigners } from "../packages/transact/src/signer.mjs";
|
|
7
|
+
import { LogicSigAccount } from "../packages/transact/src/logicsig.mjs";
|
|
8
|
+
import { MultisigAccount } from "../packages/transact/src/multisig.mjs";
|
|
9
9
|
import { DISPENSER_ACCOUNT } from "./account.mjs";
|
|
10
10
|
import { TransactionComposer } from "./composer.mjs";
|
|
11
11
|
import { KmdAccountManager } from "./kmd-account-manager.mjs";
|
|
@@ -587,8 +587,6 @@ declare class AlgorandClientTransactionCreator {
|
|
|
587
587
|
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
588
588
|
accessReferences?: ResourceReference[] | undefined;
|
|
589
589
|
rejectVersion?: number | undefined;
|
|
590
|
-
approvalProgram: string | Uint8Array;
|
|
591
|
-
clearStateProgram: string | Uint8Array;
|
|
592
590
|
schema?: {
|
|
593
591
|
globalInts: number;
|
|
594
592
|
globalByteSlices: number;
|
|
@@ -596,8 +594,10 @@ declare class AlgorandClientTransactionCreator {
|
|
|
596
594
|
localByteSlices: number;
|
|
597
595
|
} | undefined;
|
|
598
596
|
extraProgramPages?: number | undefined;
|
|
597
|
+
approvalProgram: string | Uint8Array;
|
|
598
|
+
clearStateProgram: string | Uint8Array;
|
|
599
599
|
method: ABIMethod;
|
|
600
|
-
args?: (Transaction |
|
|
600
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
601
601
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
602
602
|
sender: SendingAddress;
|
|
603
603
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -627,7 +627,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
627
627
|
localByteSlices: number;
|
|
628
628
|
} | undefined;
|
|
629
629
|
extraProgramPages?: number | undefined;
|
|
630
|
-
}> | AppMethodCall<{
|
|
630
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
631
631
|
sender: SendingAddress;
|
|
632
632
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
633
633
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -724,7 +724,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
724
724
|
approvalProgram: string | Uint8Array;
|
|
725
725
|
clearStateProgram: string | Uint8Array;
|
|
726
726
|
method: ABIMethod;
|
|
727
|
-
args?: (Transaction |
|
|
727
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
728
728
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
729
729
|
sender: SendingAddress;
|
|
730
730
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -754,7 +754,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
754
754
|
localByteSlices: number;
|
|
755
755
|
} | undefined;
|
|
756
756
|
extraProgramPages?: number | undefined;
|
|
757
|
-
}> | AppMethodCall<{
|
|
757
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
758
758
|
sender: SendingAddress;
|
|
759
759
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
760
760
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -847,7 +847,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
847
847
|
accessReferences?: ResourceReference[] | undefined;
|
|
848
848
|
rejectVersion?: number | undefined;
|
|
849
849
|
method: ABIMethod;
|
|
850
|
-
args?: (Transaction |
|
|
850
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
851
851
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
852
852
|
sender: SendingAddress;
|
|
853
853
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -877,7 +877,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
877
877
|
localByteSlices: number;
|
|
878
878
|
} | undefined;
|
|
879
879
|
extraProgramPages?: number | undefined;
|
|
880
|
-
}> | AppMethodCall<{
|
|
880
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
881
881
|
sender: SendingAddress;
|
|
882
882
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
883
883
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -970,7 +970,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
970
970
|
accessReferences?: ResourceReference[] | undefined;
|
|
971
971
|
rejectVersion?: number | undefined;
|
|
972
972
|
method: ABIMethod;
|
|
973
|
-
args?: (Transaction |
|
|
973
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
974
974
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
975
975
|
sender: SendingAddress;
|
|
976
976
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -1000,7 +1000,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
1000
1000
|
localByteSlices: number;
|
|
1001
1001
|
} | undefined;
|
|
1002
1002
|
extraProgramPages?: number | undefined;
|
|
1003
|
-
}> | AppMethodCall<{
|
|
1003
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
1004
1004
|
sender: SendingAddress;
|
|
1005
1005
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
1006
1006
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -771,8 +771,6 @@ declare class AlgorandClientTransactionSender {
|
|
|
771
771
|
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
772
772
|
accessReferences?: ResourceReference[] | undefined;
|
|
773
773
|
rejectVersion?: number | undefined;
|
|
774
|
-
approvalProgram: string | Uint8Array;
|
|
775
|
-
clearStateProgram: string | Uint8Array;
|
|
776
774
|
schema?: {
|
|
777
775
|
globalInts: number;
|
|
778
776
|
globalByteSlices: number;
|
|
@@ -780,8 +778,10 @@ declare class AlgorandClientTransactionSender {
|
|
|
780
778
|
localByteSlices: number;
|
|
781
779
|
} | undefined;
|
|
782
780
|
extraProgramPages?: number | undefined;
|
|
781
|
+
approvalProgram: string | Uint8Array;
|
|
782
|
+
clearStateProgram: string | Uint8Array;
|
|
783
783
|
method: ABIMethod;
|
|
784
|
-
args?: (Transaction |
|
|
784
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
785
785
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
786
786
|
sender: SendingAddress;
|
|
787
787
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -811,7 +811,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
811
811
|
localByteSlices: number;
|
|
812
812
|
} | undefined;
|
|
813
813
|
extraProgramPages?: number | undefined;
|
|
814
|
-
}> | AppMethodCall<{
|
|
814
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
815
815
|
sender: SendingAddress;
|
|
816
816
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
817
817
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -915,7 +915,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
915
915
|
approvalProgram: string | Uint8Array;
|
|
916
916
|
clearStateProgram: string | Uint8Array;
|
|
917
917
|
method: ABIMethod;
|
|
918
|
-
args?: (Transaction |
|
|
918
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
919
919
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
920
920
|
sender: SendingAddress;
|
|
921
921
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -945,7 +945,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
945
945
|
localByteSlices: number;
|
|
946
946
|
} | undefined;
|
|
947
947
|
extraProgramPages?: number | undefined;
|
|
948
|
-
}> | AppMethodCall<{
|
|
948
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
949
949
|
sender: SendingAddress;
|
|
950
950
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
951
951
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -1045,7 +1045,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
1045
1045
|
accessReferences?: ResourceReference[] | undefined;
|
|
1046
1046
|
rejectVersion?: number | undefined;
|
|
1047
1047
|
method: ABIMethod;
|
|
1048
|
-
args?: (Transaction |
|
|
1048
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
1049
1049
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
1050
1050
|
sender: SendingAddress;
|
|
1051
1051
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -1075,7 +1075,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
1075
1075
|
localByteSlices: number;
|
|
1076
1076
|
} | undefined;
|
|
1077
1077
|
extraProgramPages?: number | undefined;
|
|
1078
|
-
}> | AppMethodCall<{
|
|
1078
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
1079
1079
|
sender: SendingAddress;
|
|
1080
1080
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
1081
1081
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -1175,7 +1175,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
1175
1175
|
accessReferences?: ResourceReference[] | undefined;
|
|
1176
1176
|
rejectVersion?: number | undefined;
|
|
1177
1177
|
method: ABIMethod;
|
|
1178
|
-
args?: (Transaction |
|
|
1178
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
1179
1179
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
1180
1180
|
sender: SendingAddress;
|
|
1181
1181
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -1205,7 +1205,7 @@ declare class AlgorandClientTransactionSender {
|
|
|
1205
1205
|
localByteSlices: number;
|
|
1206
1206
|
} | undefined;
|
|
1207
1207
|
extraProgramPages?: number | undefined;
|
|
1208
|
-
}> | AppMethodCall<{
|
|
1208
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
1209
1209
|
sender: SendingAddress;
|
|
1210
1210
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
1211
1211
|
rekeyTo?: ReadableAddress | undefined;
|
package/types/amount.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const require_convert = require('../packages/sdk/src/convert.js');
|
|
2
1
|
|
|
3
2
|
//#region src/types/amount.ts
|
|
4
3
|
/** Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers */
|
|
@@ -14,11 +13,11 @@ var AlgoAmount = class AlgoAmount {
|
|
|
14
13
|
}
|
|
15
14
|
/** Return the amount as a number in Algo */
|
|
16
15
|
get algos() {
|
|
17
|
-
return
|
|
16
|
+
return microalgosToAlgos(Number(this.amountInMicroAlgo));
|
|
18
17
|
}
|
|
19
18
|
/** Return the amount as a number in Algo */
|
|
20
19
|
get algo() {
|
|
21
|
-
return
|
|
20
|
+
return microalgosToAlgos(Number(this.amountInMicroAlgo));
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* Create a new `AlgoAmount` instance.
|
|
@@ -31,7 +30,7 @@ var AlgoAmount = class AlgoAmount {
|
|
|
31
30
|
* ```
|
|
32
31
|
*/
|
|
33
32
|
constructor(amount) {
|
|
34
|
-
this.amountInMicroAlgo = "microAlgos" in amount ? BigInt(amount.microAlgos) : "microAlgo" in amount ? BigInt(amount.microAlgo) : "algos" in amount ? BigInt(
|
|
33
|
+
this.amountInMicroAlgo = "microAlgos" in amount ? BigInt(amount.microAlgos) : "microAlgo" in amount ? BigInt(amount.microAlgo) : "algos" in amount ? BigInt(algosToMicroalgos(Number(amount.algos))) : BigInt(algosToMicroalgos(Number(amount.algo)));
|
|
35
34
|
}
|
|
36
35
|
toString() {
|
|
37
36
|
return `${this.microAlgo.toLocaleString("en-US")} µALGO`;
|
|
@@ -60,6 +59,26 @@ var AlgoAmount = class AlgoAmount {
|
|
|
60
59
|
return new AlgoAmount({ microAlgos: amount });
|
|
61
60
|
}
|
|
62
61
|
};
|
|
62
|
+
const MICROALGOS_TO_ALGOS_RATIO = 1e6;
|
|
63
|
+
const INVALID_MICROALGOS_ERROR_MSG = "Microalgos should be positive and less than 2^53 - 1.";
|
|
64
|
+
/**
|
|
65
|
+
* microalgosToAlgos converts microalgos to algos
|
|
66
|
+
* @param microalgos - number
|
|
67
|
+
* @returns number
|
|
68
|
+
*/
|
|
69
|
+
function microalgosToAlgos(microalgos) {
|
|
70
|
+
if (microalgos < 0 || !Number.isSafeInteger(microalgos)) throw new Error(INVALID_MICROALGOS_ERROR_MSG);
|
|
71
|
+
return microalgos / MICROALGOS_TO_ALGOS_RATIO;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* algosToMicroalgos converts algos to microalgos
|
|
75
|
+
* @param algos - number
|
|
76
|
+
* @returns number
|
|
77
|
+
*/
|
|
78
|
+
function algosToMicroalgos(algos) {
|
|
79
|
+
const microalgos = algos * MICROALGOS_TO_ALGOS_RATIO;
|
|
80
|
+
return Math.round(microalgos);
|
|
81
|
+
}
|
|
63
82
|
|
|
64
83
|
//#endregion
|
|
65
84
|
exports.AlgoAmount = AlgoAmount;
|
package/types/amount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.js","names":[],"sources":["../../src/types/amount.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"amount.js","names":[],"sources":["../../src/types/amount.ts"],"sourcesContent":["/** Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers */\nexport class AlgoAmount {\n private amountInMicroAlgo: bigint\n\n /** Return the amount as a number in µAlgo */\n get microAlgos() {\n return this.amountInMicroAlgo\n }\n\n /** Return the amount as a number in µAlgo */\n get microAlgo() {\n return this.amountInMicroAlgo\n }\n\n /** Return the amount as a number in Algo */\n get algos() {\n return microalgosToAlgos(Number(this.amountInMicroAlgo))\n }\n\n /** Return the amount as a number in Algo */\n get algo() {\n return microalgosToAlgos(Number(this.amountInMicroAlgo))\n }\n\n /**\n * Create a new `AlgoAmount` instance.\n *\n * @param amount - An object specifying the amount in Algo or µALGO. Use the key 'algo' for Algo amounts and 'microAlgo' for µALGO.\n * @returns A new instance of `AlgoAmount` representing the specified amount.\n * @example\n * ```typescript\n * const amount = new AlgoAmount({ algo: 5 });\n * ```\n */\n constructor(\n amount: { algos: number | bigint } | { algo: number | bigint } | { microAlgos: number | bigint } | { microAlgo: number | bigint },\n ) {\n this.amountInMicroAlgo =\n 'microAlgos' in amount\n ? BigInt(amount.microAlgos)\n : 'microAlgo' in amount\n ? BigInt(amount.microAlgo)\n : 'algos' in amount\n ? BigInt(algosToMicroalgos(Number(amount.algos)))\n : BigInt(algosToMicroalgos(Number(amount.algo)))\n }\n\n toString(): string {\n return `${this.microAlgo.toLocaleString('en-US')} µALGO`\n }\n\n /** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,\n * but it's not recommended to use this to convert to a number, it's much safer to explicitly call\n * the algos or microAlgos properties\n */\n valueOf(): number {\n return Number(this.microAlgo)\n }\n\n /** Create a `AlgoAmount` object representing the given number of Algo */\n static Algos(amount: number | bigint) {\n return new AlgoAmount({ algos: amount })\n }\n\n /** Create a `AlgoAmount` object representing the given number of Algo */\n static Algo(amount: number | bigint) {\n return new AlgoAmount({ algos: amount })\n }\n\n /** Create a `AlgoAmount` object representing the given number of µAlgo */\n static MicroAlgos(amount: number | bigint) {\n return new AlgoAmount({ microAlgos: amount })\n }\n\n /** Create a `AlgoAmount` object representing the given number of µAlgo */\n static MicroAlgo(amount: number | bigint) {\n return new AlgoAmount({ microAlgos: amount })\n }\n}\n\nconst MICROALGOS_TO_ALGOS_RATIO = 1e6\nconst INVALID_MICROALGOS_ERROR_MSG = 'Microalgos should be positive and less than 2^53 - 1.'\n\n/**\n * microalgosToAlgos converts microalgos to algos\n * @param microalgos - number\n * @returns number\n */\nfunction microalgosToAlgos(microalgos: number) {\n if (microalgos < 0 || !Number.isSafeInteger(microalgos)) {\n throw new Error(INVALID_MICROALGOS_ERROR_MSG)\n }\n return microalgos / MICROALGOS_TO_ALGOS_RATIO\n}\n\n/**\n * algosToMicroalgos converts algos to microalgos\n * @param algos - number\n * @returns number\n */\nfunction algosToMicroalgos(algos: number) {\n const microalgos = algos * MICROALGOS_TO_ALGOS_RATIO\n return Math.round(microalgos)\n}\n"],"mappings":";;;AACA,IAAa,aAAb,MAAa,WAAW;CACtB,AAAQ;;CAGR,IAAI,aAAa;AACf,SAAO,KAAK;;;CAId,IAAI,YAAY;AACd,SAAO,KAAK;;;CAId,IAAI,QAAQ;AACV,SAAO,kBAAkB,OAAO,KAAK,kBAAkB,CAAC;;;CAI1D,IAAI,OAAO;AACT,SAAO,kBAAkB,OAAO,KAAK,kBAAkB,CAAC;;;;;;;;;;;;CAa1D,YACE,QACA;AACA,OAAK,oBACH,gBAAgB,SACZ,OAAO,OAAO,WAAW,GACzB,eAAe,SACb,OAAO,OAAO,UAAU,GACxB,WAAW,SACT,OAAO,kBAAkB,OAAO,OAAO,MAAM,CAAC,CAAC,GAC/C,OAAO,kBAAkB,OAAO,OAAO,KAAK,CAAC,CAAC;;CAG1D,WAAmB;AACjB,SAAO,GAAG,KAAK,UAAU,eAAe,QAAQ,CAAC;;;;;;CAOnD,UAAkB;AAChB,SAAO,OAAO,KAAK,UAAU;;;CAI/B,OAAO,MAAM,QAAyB;AACpC,SAAO,IAAI,WAAW,EAAE,OAAO,QAAQ,CAAC;;;CAI1C,OAAO,KAAK,QAAyB;AACnC,SAAO,IAAI,WAAW,EAAE,OAAO,QAAQ,CAAC;;;CAI1C,OAAO,WAAW,QAAyB;AACzC,SAAO,IAAI,WAAW,EAAE,YAAY,QAAQ,CAAC;;;CAI/C,OAAO,UAAU,QAAyB;AACxC,SAAO,IAAI,WAAW,EAAE,YAAY,QAAQ,CAAC;;;AAIjD,MAAM,4BAA4B;AAClC,MAAM,+BAA+B;;;;;;AAOrC,SAAS,kBAAkB,YAAoB;AAC7C,KAAI,aAAa,KAAK,CAAC,OAAO,cAAc,WAAW,CACrD,OAAM,IAAI,MAAM,6BAA6B;AAE/C,QAAO,aAAa;;;;;;;AAQtB,SAAS,kBAAkB,OAAe;CACxC,MAAM,aAAa,QAAQ;AAC3B,QAAO,KAAK,MAAM,WAAW"}
|
package/types/amount.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { algosToMicroalgos, microalgosToAlgos } from "../packages/sdk/src/convert.mjs";
|
|
2
|
-
|
|
3
1
|
//#region src/types/amount.ts
|
|
4
2
|
/** Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers */
|
|
5
3
|
var AlgoAmount = class AlgoAmount {
|
|
@@ -60,6 +58,26 @@ var AlgoAmount = class AlgoAmount {
|
|
|
60
58
|
return new AlgoAmount({ microAlgos: amount });
|
|
61
59
|
}
|
|
62
60
|
};
|
|
61
|
+
const MICROALGOS_TO_ALGOS_RATIO = 1e6;
|
|
62
|
+
const INVALID_MICROALGOS_ERROR_MSG = "Microalgos should be positive and less than 2^53 - 1.";
|
|
63
|
+
/**
|
|
64
|
+
* microalgosToAlgos converts microalgos to algos
|
|
65
|
+
* @param microalgos - number
|
|
66
|
+
* @returns number
|
|
67
|
+
*/
|
|
68
|
+
function microalgosToAlgos(microalgos) {
|
|
69
|
+
if (microalgos < 0 || !Number.isSafeInteger(microalgos)) throw new Error(INVALID_MICROALGOS_ERROR_MSG);
|
|
70
|
+
return microalgos / MICROALGOS_TO_ALGOS_RATIO;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* algosToMicroalgos converts algos to microalgos
|
|
74
|
+
* @param algos - number
|
|
75
|
+
* @returns number
|
|
76
|
+
*/
|
|
77
|
+
function algosToMicroalgos(algos) {
|
|
78
|
+
const microalgos = algos * MICROALGOS_TO_ALGOS_RATIO;
|
|
79
|
+
return Math.round(microalgos);
|
|
80
|
+
}
|
|
63
81
|
|
|
64
82
|
//#endregion
|
|
65
83
|
export { AlgoAmount };
|
package/types/amount.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.mjs","names":[
|
|
1
|
+
{"version":3,"file":"amount.mjs","names":[],"sources":["../../src/types/amount.ts"],"sourcesContent":["/** Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers */\nexport class AlgoAmount {\n private amountInMicroAlgo: bigint\n\n /** Return the amount as a number in µAlgo */\n get microAlgos() {\n return this.amountInMicroAlgo\n }\n\n /** Return the amount as a number in µAlgo */\n get microAlgo() {\n return this.amountInMicroAlgo\n }\n\n /** Return the amount as a number in Algo */\n get algos() {\n return microalgosToAlgos(Number(this.amountInMicroAlgo))\n }\n\n /** Return the amount as a number in Algo */\n get algo() {\n return microalgosToAlgos(Number(this.amountInMicroAlgo))\n }\n\n /**\n * Create a new `AlgoAmount` instance.\n *\n * @param amount - An object specifying the amount in Algo or µALGO. Use the key 'algo' for Algo amounts and 'microAlgo' for µALGO.\n * @returns A new instance of `AlgoAmount` representing the specified amount.\n * @example\n * ```typescript\n * const amount = new AlgoAmount({ algo: 5 });\n * ```\n */\n constructor(\n amount: { algos: number | bigint } | { algo: number | bigint } | { microAlgos: number | bigint } | { microAlgo: number | bigint },\n ) {\n this.amountInMicroAlgo =\n 'microAlgos' in amount\n ? BigInt(amount.microAlgos)\n : 'microAlgo' in amount\n ? BigInt(amount.microAlgo)\n : 'algos' in amount\n ? BigInt(algosToMicroalgos(Number(amount.algos)))\n : BigInt(algosToMicroalgos(Number(amount.algo)))\n }\n\n toString(): string {\n return `${this.microAlgo.toLocaleString('en-US')} µALGO`\n }\n\n /** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,\n * but it's not recommended to use this to convert to a number, it's much safer to explicitly call\n * the algos or microAlgos properties\n */\n valueOf(): number {\n return Number(this.microAlgo)\n }\n\n /** Create a `AlgoAmount` object representing the given number of Algo */\n static Algos(amount: number | bigint) {\n return new AlgoAmount({ algos: amount })\n }\n\n /** Create a `AlgoAmount` object representing the given number of Algo */\n static Algo(amount: number | bigint) {\n return new AlgoAmount({ algos: amount })\n }\n\n /** Create a `AlgoAmount` object representing the given number of µAlgo */\n static MicroAlgos(amount: number | bigint) {\n return new AlgoAmount({ microAlgos: amount })\n }\n\n /** Create a `AlgoAmount` object representing the given number of µAlgo */\n static MicroAlgo(amount: number | bigint) {\n return new AlgoAmount({ microAlgos: amount })\n }\n}\n\nconst MICROALGOS_TO_ALGOS_RATIO = 1e6\nconst INVALID_MICROALGOS_ERROR_MSG = 'Microalgos should be positive and less than 2^53 - 1.'\n\n/**\n * microalgosToAlgos converts microalgos to algos\n * @param microalgos - number\n * @returns number\n */\nfunction microalgosToAlgos(microalgos: number) {\n if (microalgos < 0 || !Number.isSafeInteger(microalgos)) {\n throw new Error(INVALID_MICROALGOS_ERROR_MSG)\n }\n return microalgos / MICROALGOS_TO_ALGOS_RATIO\n}\n\n/**\n * algosToMicroalgos converts algos to microalgos\n * @param algos - number\n * @returns number\n */\nfunction algosToMicroalgos(algos: number) {\n const microalgos = algos * MICROALGOS_TO_ALGOS_RATIO\n return Math.round(microalgos)\n}\n"],"mappings":";;AACA,IAAa,aAAb,MAAa,WAAW;CACtB,AAAQ;;CAGR,IAAI,aAAa;AACf,SAAO,KAAK;;;CAId,IAAI,YAAY;AACd,SAAO,KAAK;;;CAId,IAAI,QAAQ;AACV,SAAO,kBAAkB,OAAO,KAAK,kBAAkB,CAAC;;;CAI1D,IAAI,OAAO;AACT,SAAO,kBAAkB,OAAO,KAAK,kBAAkB,CAAC;;;;;;;;;;;;CAa1D,YACE,QACA;AACA,OAAK,oBACH,gBAAgB,SACZ,OAAO,OAAO,WAAW,GACzB,eAAe,SACb,OAAO,OAAO,UAAU,GACxB,WAAW,SACT,OAAO,kBAAkB,OAAO,OAAO,MAAM,CAAC,CAAC,GAC/C,OAAO,kBAAkB,OAAO,OAAO,KAAK,CAAC,CAAC;;CAG1D,WAAmB;AACjB,SAAO,GAAG,KAAK,UAAU,eAAe,QAAQ,CAAC;;;;;;CAOnD,UAAkB;AAChB,SAAO,OAAO,KAAK,UAAU;;;CAI/B,OAAO,MAAM,QAAyB;AACpC,SAAO,IAAI,WAAW,EAAE,OAAO,QAAQ,CAAC;;;CAI1C,OAAO,KAAK,QAAyB;AACnC,SAAO,IAAI,WAAW,EAAE,OAAO,QAAQ,CAAC;;;CAI1C,OAAO,WAAW,QAAyB;AACzC,SAAO,IAAI,WAAW,EAAE,YAAY,QAAQ,CAAC;;;CAI/C,OAAO,UAAU,QAAyB;AACxC,SAAO,IAAI,WAAW,EAAE,YAAY,QAAQ,CAAC;;;AAIjD,MAAM,4BAA4B;AAClC,MAAM,+BAA+B;;;;;;AAOrC,SAAS,kBAAkB,YAAoB;AAC7C,KAAI,aAAa,KAAK,CAAC,OAAO,cAAc,WAAW,CACrD,OAAM,IAAI,MAAM,6BAA6B;AAE/C,QAAO,aAAa;;;;;;;AAQtB,SAAS,kBAAkB,OAAe;CACxC,MAAM,aAAa,QAAQ;AAC3B,QAAO,KAAK,MAAM,WAAW"}
|
package/types/app-client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Address, ReadableAddress } from "../packages/common/src/address.js";
|
|
2
2
|
import { Expand } from "../packages/common/src/expand.js";
|
|
3
|
+
import { ProgramSourceMap } from "../packages/common/src/sourcemap.js";
|
|
3
4
|
import { ABIValue } from "../packages/abi/src/abi-value.js";
|
|
4
5
|
import { Arc56Contract, ProgramSourceInfo } from "../packages/abi/src/arc56-contract.js";
|
|
5
6
|
import { ABIType } from "../packages/abi/src/abi-type.js";
|
|
@@ -10,7 +11,6 @@ import { AddressWithTransactionSigner, SendingAddress, TransactionSigner } from
|
|
|
10
11
|
import { PendingTransactionResponse } from "../packages/algod_client/src/models/pending-transaction-response.js";
|
|
11
12
|
import { SuggestedParams } from "../packages/algod_client/src/models/suggested-params.js";
|
|
12
13
|
import { AlgoAmount } from "./amount.js";
|
|
13
|
-
import { ProgramSourceMap } from "../packages/sdk/src/logic/sourcemap.js";
|
|
14
14
|
import { AppManager, BoxIdentifier, BoxReference } from "./app-manager.js";
|
|
15
15
|
import { AppCallParams, AppDeleteParams, AppMethodCallParams, CommonAppCallParams } from "../transactions/app-call.js";
|
|
16
16
|
import { AppMethodCall, AppMethodCallTransactionArgument } from "../transactions/method-call.js";
|
|
@@ -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 |
|
|
491
|
+
args: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
492
492
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
493
493
|
sender: SendingAddress;
|
|
494
494
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -518,7 +518,7 @@ declare class AppClient {
|
|
|
518
518
|
localByteSlices: number;
|
|
519
519
|
} | undefined;
|
|
520
520
|
extraProgramPages?: number | undefined;
|
|
521
|
-
}> | AppMethodCall<{
|
|
521
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
522
522
|
sender: SendingAddress;
|
|
523
523
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
524
524
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -590,7 +590,7 @@ declare class AppClient {
|
|
|
590
590
|
accessReferences?: ResourceReference[] | undefined;
|
|
591
591
|
rejectVersion?: number | undefined;
|
|
592
592
|
method: ABIMethod;
|
|
593
|
-
args?: (Transaction |
|
|
593
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
594
594
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
595
595
|
sender: SendingAddress;
|
|
596
596
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -620,7 +620,7 @@ declare class AppClient {
|
|
|
620
620
|
localByteSlices: number;
|
|
621
621
|
} | undefined;
|
|
622
622
|
extraProgramPages?: number | undefined;
|
|
623
|
-
}> | AppMethodCall<{
|
|
623
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
624
624
|
sender: SendingAddress;
|
|
625
625
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
626
626
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -692,7 +692,7 @@ declare class AppClient {
|
|
|
692
692
|
accessReferences?: ResourceReference[] | undefined;
|
|
693
693
|
rejectVersion?: number | undefined;
|
|
694
694
|
method: ABIMethod;
|
|
695
|
-
args?: (Transaction |
|
|
695
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
696
696
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
697
697
|
sender: SendingAddress;
|
|
698
698
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -722,7 +722,7 @@ declare class AppClient {
|
|
|
722
722
|
localByteSlices: number;
|
|
723
723
|
} | undefined;
|
|
724
724
|
extraProgramPages?: number | undefined;
|
|
725
|
-
}> | AppMethodCall<{
|
|
725
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
726
726
|
sender: SendingAddress;
|
|
727
727
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
728
728
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -793,7 +793,7 @@ declare class AppClient {
|
|
|
793
793
|
accessReferences?: ResourceReference[] | undefined;
|
|
794
794
|
rejectVersion?: number | undefined;
|
|
795
795
|
method: ABIMethod;
|
|
796
|
-
args?: (Transaction |
|
|
796
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
797
797
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
798
798
|
sender: SendingAddress;
|
|
799
799
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -823,7 +823,7 @@ declare class AppClient {
|
|
|
823
823
|
localByteSlices: number;
|
|
824
824
|
} | undefined;
|
|
825
825
|
extraProgramPages?: number | undefined;
|
|
826
|
-
}> | AppMethodCall<{
|
|
826
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
827
827
|
sender: SendingAddress;
|
|
828
828
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
829
829
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -894,7 +894,7 @@ declare class AppClient {
|
|
|
894
894
|
accessReferences?: ResourceReference[] | undefined;
|
|
895
895
|
rejectVersion?: number | undefined;
|
|
896
896
|
method: ABIMethod;
|
|
897
|
-
args?: (Transaction |
|
|
897
|
+
args?: (Transaction | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
898
898
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
899
899
|
sender: SendingAddress;
|
|
900
900
|
rekeyTo?: ReadableAddress | undefined;
|
|
@@ -924,7 +924,7 @@ declare class AppClient {
|
|
|
924
924
|
localByteSlices: number;
|
|
925
925
|
} | undefined;
|
|
926
926
|
extraProgramPages?: number | undefined;
|
|
927
|
-
}> | AppMethodCall<{
|
|
927
|
+
}> | Promise<Transaction> | AppMethodCall<{
|
|
928
928
|
sender: SendingAddress;
|
|
929
929
|
signer?: AddressWithTransactionSigner | TransactionSigner | undefined;
|
|
930
930
|
rekeyTo?: ReadableAddress | undefined;
|
package/types/app-client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_address = require('../packages/common/src/address.js');
|
|
3
|
-
const require_app_call = require('../packages/transact/src/transactions/app-call.js');
|
|
4
|
-
const require_sourcemap = require('../packages/sdk/src/logic/sourcemap.js');
|
|
5
3
|
const require_config = require('../config.js');
|
|
6
4
|
const require_util = require('../util.js');
|
|
5
|
+
const require_sourcemap = require('../packages/common/src/sourcemap.js');
|
|
6
|
+
const require_app_call = require('../packages/transact/src/transactions/app-call.js');
|
|
7
7
|
const require_abi_method = require('../packages/abi/src/abi-method.js');
|
|
8
8
|
const require_arc56_contract = require('../packages/abi/src/arc56-contract.js');
|
|
9
9
|
const require_lifecycle_events = require('./lifecycle-events.js');
|