algosdk 3.5.1 → 3.6.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 +14 -6
- package/dist/cjs/appAccess.js.map +1 -1
- package/dist/cjs/client/v2/algod/accountApplicationsInformation.js +38 -0
- package/dist/cjs/client/v2/algod/accountApplicationsInformation.js.map +1 -0
- package/dist/cjs/client/v2/algod/accountAssetsInformation.js +31 -0
- package/dist/cjs/client/v2/algod/accountAssetsInformation.js.map +1 -0
- package/dist/cjs/client/v2/algod/algod.js +23 -1
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +116 -5
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +243 -20
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/dryrun.js.map +1 -1
- package/dist/cjs/transaction.js +1 -0
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/esm/appAccess.js +14 -6
- package/dist/esm/appAccess.js.map +1 -1
- package/dist/esm/client/v2/algod/accountApplicationsInformation.js +32 -0
- package/dist/esm/client/v2/algod/accountApplicationsInformation.js.map +1 -0
- package/dist/esm/client/v2/algod/accountAssetsInformation.js +25 -0
- package/dist/esm/client/v2/algod/accountAssetsInformation.js.map +1 -0
- package/dist/esm/client/v2/algod/algod.js +23 -1
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +116 -5
- package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +239 -18
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/dryrun.js.map +1 -1
- package/dist/esm/transaction.js +1 -0
- package/dist/esm/transaction.js.map +1 -1
- package/dist/types/client/v2/algod/accountApplicationsInformation.d.ts +16 -0
- package/dist/types/client/v2/algod/accountAssetsInformation.d.ts +12 -0
- package/dist/types/client/v2/algod/algod.d.ts +19 -1
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +100 -5
- package/dist/types/client/v2/algod/models/types.d.ts +146 -15
- package/package.json +1 -1
- package/src/appAccess.ts +17 -6
- package/src/client/v2/algod/accountApplicationsInformation.ts +46 -0
- package/src/client/v2/algod/accountAssetsInformation.ts +33 -0
- package/src/client/v2/algod/algod.ts +25 -1
- package/src/client/v2/algod/getApplicationBoxes.ts +123 -5
- package/src/client/v2/algod/models/types.ts +409 -32
- package/src/dryrun.ts +2 -2
- package/src/transaction.ts +1 -0
|
@@ -621,6 +621,152 @@ export class Account implements Encodable {
|
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
|
|
624
|
+
/**
|
|
625
|
+
* AccountApplicationResource describes the account's application resource (local
|
|
626
|
+
* state and params if the account is the creator) for a specific application ID.
|
|
627
|
+
*/
|
|
628
|
+
export class AccountApplicationResource implements Encodable {
|
|
629
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
630
|
+
|
|
631
|
+
static get encodingSchema(): Schema {
|
|
632
|
+
if (!this.encodingSchemaValue) {
|
|
633
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
634
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
635
|
+
{ key: 'id', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
636
|
+
{
|
|
637
|
+
key: 'app-local-state',
|
|
638
|
+
valueSchema: new OptionalSchema(ApplicationLocalState.encodingSchema),
|
|
639
|
+
omitEmpty: true,
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
key: 'created-at-round',
|
|
643
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
644
|
+
omitEmpty: true,
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
key: 'deleted',
|
|
648
|
+
valueSchema: new OptionalSchema(new BooleanSchema()),
|
|
649
|
+
omitEmpty: true,
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
key: 'params',
|
|
653
|
+
valueSchema: new OptionalSchema(ApplicationParams.encodingSchema),
|
|
654
|
+
omitEmpty: true,
|
|
655
|
+
}
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
return this.encodingSchemaValue;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* The application ID.
|
|
663
|
+
*/
|
|
664
|
+
public id: number;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* (appl) the application local data stored in this account.
|
|
668
|
+
* The raw account uses `AppLocalState` for this type.
|
|
669
|
+
*/
|
|
670
|
+
public appLocalState?: ApplicationLocalState;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Round when the account opted into or created the application.
|
|
674
|
+
*/
|
|
675
|
+
public createdAtRound?: number;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Whether the application has been deleted.
|
|
679
|
+
*/
|
|
680
|
+
public deleted?: boolean;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* (appp) parameters of the application created by this account including app
|
|
684
|
+
* global data.
|
|
685
|
+
* The raw account uses `AppParams` for this type.
|
|
686
|
+
* Only present if the account is the creator and `include=params` is specified.
|
|
687
|
+
*/
|
|
688
|
+
public params?: ApplicationParams;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Creates a new `AccountApplicationResource` object.
|
|
692
|
+
* @param id - The application ID.
|
|
693
|
+
* @param appLocalState - (appl) the application local data stored in this account.
|
|
694
|
+
* The raw account uses `AppLocalState` for this type.
|
|
695
|
+
* @param createdAtRound - Round when the account opted into or created the application.
|
|
696
|
+
* @param deleted - Whether the application has been deleted.
|
|
697
|
+
* @param params - (appp) parameters of the application created by this account including app
|
|
698
|
+
* global data.
|
|
699
|
+
* The raw account uses `AppParams` for this type.
|
|
700
|
+
* Only present if the account is the creator and `include=params` is specified.
|
|
701
|
+
*/
|
|
702
|
+
constructor({
|
|
703
|
+
id,
|
|
704
|
+
appLocalState,
|
|
705
|
+
createdAtRound,
|
|
706
|
+
deleted,
|
|
707
|
+
params,
|
|
708
|
+
}: {
|
|
709
|
+
id: number | bigint;
|
|
710
|
+
appLocalState?: ApplicationLocalState;
|
|
711
|
+
createdAtRound?: number | bigint;
|
|
712
|
+
deleted?: boolean;
|
|
713
|
+
params?: ApplicationParams;
|
|
714
|
+
}) {
|
|
715
|
+
this.id = ensureSafeInteger(id);
|
|
716
|
+
this.appLocalState = appLocalState;
|
|
717
|
+
this.createdAtRound =
|
|
718
|
+
typeof createdAtRound === 'undefined'
|
|
719
|
+
? undefined
|
|
720
|
+
: ensureSafeInteger(createdAtRound);
|
|
721
|
+
this.deleted = deleted;
|
|
722
|
+
this.params = params;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// eslint-disable-next-line class-methods-use-this
|
|
726
|
+
getEncodingSchema(): Schema {
|
|
727
|
+
return AccountApplicationResource.encodingSchema;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
toEncodingData(): Map<string, unknown> {
|
|
731
|
+
return new Map<string, unknown>([
|
|
732
|
+
['id', this.id],
|
|
733
|
+
[
|
|
734
|
+
'app-local-state',
|
|
735
|
+
typeof this.appLocalState !== 'undefined'
|
|
736
|
+
? this.appLocalState.toEncodingData()
|
|
737
|
+
: undefined,
|
|
738
|
+
],
|
|
739
|
+
['created-at-round', this.createdAtRound],
|
|
740
|
+
['deleted', this.deleted],
|
|
741
|
+
[
|
|
742
|
+
'params',
|
|
743
|
+
typeof this.params !== 'undefined'
|
|
744
|
+
? this.params.toEncodingData()
|
|
745
|
+
: undefined,
|
|
746
|
+
],
|
|
747
|
+
]);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
static fromEncodingData(data: unknown): AccountApplicationResource {
|
|
751
|
+
if (!(data instanceof Map)) {
|
|
752
|
+
throw new Error(`Invalid decoded AccountApplicationResource: ${data}`);
|
|
753
|
+
}
|
|
754
|
+
return new AccountApplicationResource({
|
|
755
|
+
id: data.get('id'),
|
|
756
|
+
appLocalState:
|
|
757
|
+
typeof data.get('app-local-state') !== 'undefined'
|
|
758
|
+
? ApplicationLocalState.fromEncodingData(data.get('app-local-state'))
|
|
759
|
+
: undefined,
|
|
760
|
+
createdAtRound: data.get('created-at-round'),
|
|
761
|
+
deleted: data.get('deleted'),
|
|
762
|
+
params:
|
|
763
|
+
typeof data.get('params') !== 'undefined'
|
|
764
|
+
? ApplicationParams.fromEncodingData(data.get('params'))
|
|
765
|
+
: undefined,
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
624
770
|
/**
|
|
625
771
|
* AccountApplicationResponse describes the account's application local state and
|
|
626
772
|
* global state (AppLocalState and AppParams, if either exists) for a specific
|
|
@@ -732,6 +878,112 @@ export class AccountApplicationResponse implements Encodable {
|
|
|
732
878
|
}
|
|
733
879
|
}
|
|
734
880
|
|
|
881
|
+
/**
|
|
882
|
+
* AccountApplicationsInformationResponse contains a list of application resources
|
|
883
|
+
* for an account.
|
|
884
|
+
*/
|
|
885
|
+
export class AccountApplicationsInformationResponse implements Encodable {
|
|
886
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
887
|
+
|
|
888
|
+
static get encodingSchema(): Schema {
|
|
889
|
+
if (!this.encodingSchemaValue) {
|
|
890
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
891
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
892
|
+
{ key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
893
|
+
{
|
|
894
|
+
key: 'application-resources',
|
|
895
|
+
valueSchema: new OptionalSchema(
|
|
896
|
+
new ArraySchema(AccountApplicationResource.encodingSchema)
|
|
897
|
+
),
|
|
898
|
+
omitEmpty: true,
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
key: 'next-token',
|
|
902
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
903
|
+
omitEmpty: true,
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
return this.encodingSchemaValue;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* The round for which this information is relevant.
|
|
912
|
+
*/
|
|
913
|
+
public round: number;
|
|
914
|
+
|
|
915
|
+
public applicationResources?: AccountApplicationResource[];
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Used for pagination, when making another request provide this token with the
|
|
919
|
+
* next parameter. The next token is the next application ID to use as the
|
|
920
|
+
* pagination cursor.
|
|
921
|
+
*/
|
|
922
|
+
public nextToken?: string;
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Creates a new `AccountApplicationsInformationResponse` object.
|
|
926
|
+
* @param round - The round for which this information is relevant.
|
|
927
|
+
* @param applicationResources -
|
|
928
|
+
* @param nextToken - Used for pagination, when making another request provide this token with the
|
|
929
|
+
* next parameter. The next token is the next application ID to use as the
|
|
930
|
+
* pagination cursor.
|
|
931
|
+
*/
|
|
932
|
+
constructor({
|
|
933
|
+
round,
|
|
934
|
+
applicationResources,
|
|
935
|
+
nextToken,
|
|
936
|
+
}: {
|
|
937
|
+
round: number | bigint;
|
|
938
|
+
applicationResources?: AccountApplicationResource[];
|
|
939
|
+
nextToken?: string;
|
|
940
|
+
}) {
|
|
941
|
+
this.round = ensureSafeInteger(round);
|
|
942
|
+
this.applicationResources = applicationResources;
|
|
943
|
+
this.nextToken = nextToken;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// eslint-disable-next-line class-methods-use-this
|
|
947
|
+
getEncodingSchema(): Schema {
|
|
948
|
+
return AccountApplicationsInformationResponse.encodingSchema;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
toEncodingData(): Map<string, unknown> {
|
|
952
|
+
return new Map<string, unknown>([
|
|
953
|
+
['round', this.round],
|
|
954
|
+
[
|
|
955
|
+
'application-resources',
|
|
956
|
+
typeof this.applicationResources !== 'undefined'
|
|
957
|
+
? this.applicationResources.map((v) => v.toEncodingData())
|
|
958
|
+
: undefined,
|
|
959
|
+
],
|
|
960
|
+
['next-token', this.nextToken],
|
|
961
|
+
]);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
static fromEncodingData(
|
|
965
|
+
data: unknown
|
|
966
|
+
): AccountApplicationsInformationResponse {
|
|
967
|
+
if (!(data instanceof Map)) {
|
|
968
|
+
throw new Error(
|
|
969
|
+
`Invalid decoded AccountApplicationsInformationResponse: ${data}`
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
return new AccountApplicationsInformationResponse({
|
|
973
|
+
round: data.get('round'),
|
|
974
|
+
applicationResources:
|
|
975
|
+
typeof data.get('application-resources') !== 'undefined'
|
|
976
|
+
? data
|
|
977
|
+
.get('application-resources')
|
|
978
|
+
.map((v: unknown) =>
|
|
979
|
+
AccountApplicationResource.fromEncodingData(v)
|
|
980
|
+
)
|
|
981
|
+
: undefined,
|
|
982
|
+
nextToken: data.get('next-token'),
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
735
987
|
/**
|
|
736
988
|
* AccountAssetHolding describes the account's asset holding and asset parameters
|
|
737
989
|
* (if either exist) for a specific asset ID.
|
|
@@ -1347,7 +1599,7 @@ export class Application implements Encodable {
|
|
|
1347
1599
|
{ key: 'id', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
1348
1600
|
{
|
|
1349
1601
|
key: 'params',
|
|
1350
|
-
valueSchema: ApplicationParams.encodingSchema,
|
|
1602
|
+
valueSchema: new OptionalSchema(ApplicationParams.encodingSchema),
|
|
1351
1603
|
omitEmpty: true,
|
|
1352
1604
|
}
|
|
1353
1605
|
);
|
|
@@ -1363,7 +1615,7 @@ export class Application implements Encodable {
|
|
|
1363
1615
|
/**
|
|
1364
1616
|
* (appparams) application parameters.
|
|
1365
1617
|
*/
|
|
1366
|
-
public params
|
|
1618
|
+
public params?: ApplicationParams;
|
|
1367
1619
|
|
|
1368
1620
|
/**
|
|
1369
1621
|
* Creates a new `Application` object.
|
|
@@ -1375,7 +1627,7 @@ export class Application implements Encodable {
|
|
|
1375
1627
|
params,
|
|
1376
1628
|
}: {
|
|
1377
1629
|
id: number | bigint;
|
|
1378
|
-
params
|
|
1630
|
+
params?: ApplicationParams;
|
|
1379
1631
|
}) {
|
|
1380
1632
|
this.id = ensureBigInt(id);
|
|
1381
1633
|
this.params = params;
|
|
@@ -1389,7 +1641,12 @@ export class Application implements Encodable {
|
|
|
1389
1641
|
toEncodingData(): Map<string, unknown> {
|
|
1390
1642
|
return new Map<string, unknown>([
|
|
1391
1643
|
['id', this.id],
|
|
1392
|
-
[
|
|
1644
|
+
[
|
|
1645
|
+
'params',
|
|
1646
|
+
typeof this.params !== 'undefined'
|
|
1647
|
+
? this.params.toEncodingData()
|
|
1648
|
+
: undefined,
|
|
1649
|
+
],
|
|
1393
1650
|
]);
|
|
1394
1651
|
}
|
|
1395
1652
|
|
|
@@ -1399,9 +1656,10 @@ export class Application implements Encodable {
|
|
|
1399
1656
|
}
|
|
1400
1657
|
return new Application({
|
|
1401
1658
|
id: data.get('id'),
|
|
1402
|
-
params:
|
|
1403
|
-
data.get('params')
|
|
1404
|
-
|
|
1659
|
+
params:
|
|
1660
|
+
typeof data.get('params') !== 'undefined'
|
|
1661
|
+
? ApplicationParams.fromEncodingData(data.get('params'))
|
|
1662
|
+
: undefined,
|
|
1405
1663
|
});
|
|
1406
1664
|
}
|
|
1407
1665
|
}
|
|
@@ -1833,6 +2091,11 @@ export class ApplicationParams implements Encodable {
|
|
|
1833
2091
|
),
|
|
1834
2092
|
omitEmpty: true,
|
|
1835
2093
|
},
|
|
2094
|
+
{
|
|
2095
|
+
key: 'size-sponsor',
|
|
2096
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
2097
|
+
omitEmpty: true,
|
|
2098
|
+
},
|
|
1836
2099
|
{
|
|
1837
2100
|
key: 'version',
|
|
1838
2101
|
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
@@ -1879,6 +2142,11 @@ export class ApplicationParams implements Encodable {
|
|
|
1879
2142
|
*/
|
|
1880
2143
|
public localStateSchema?: ApplicationStateSchema;
|
|
1881
2144
|
|
|
2145
|
+
/**
|
|
2146
|
+
* (ss) the account responsible for extra pages and global state MBR
|
|
2147
|
+
*/
|
|
2148
|
+
public sizeSponsor?: Address;
|
|
2149
|
+
|
|
1882
2150
|
/**
|
|
1883
2151
|
* (v) the number of updates to the application programs
|
|
1884
2152
|
*/
|
|
@@ -1894,6 +2162,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1894
2162
|
* @param globalState - (gs) global state
|
|
1895
2163
|
* @param globalStateSchema - (gsch) global schema
|
|
1896
2164
|
* @param localStateSchema - (lsch) local schema
|
|
2165
|
+
* @param sizeSponsor - (ss) the account responsible for extra pages and global state MBR
|
|
1897
2166
|
* @param version - (v) the number of updates to the application programs
|
|
1898
2167
|
*/
|
|
1899
2168
|
constructor({
|
|
@@ -1904,6 +2173,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1904
2173
|
globalState,
|
|
1905
2174
|
globalStateSchema,
|
|
1906
2175
|
localStateSchema,
|
|
2176
|
+
sizeSponsor,
|
|
1907
2177
|
version,
|
|
1908
2178
|
}: {
|
|
1909
2179
|
approvalProgram: string | Uint8Array;
|
|
@@ -1913,6 +2183,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1913
2183
|
globalState?: TealKeyValue[];
|
|
1914
2184
|
globalStateSchema?: ApplicationStateSchema;
|
|
1915
2185
|
localStateSchema?: ApplicationStateSchema;
|
|
2186
|
+
sizeSponsor?: Address | string;
|
|
1916
2187
|
version?: number | bigint;
|
|
1917
2188
|
}) {
|
|
1918
2189
|
this.approvalProgram =
|
|
@@ -1932,6 +2203,10 @@ export class ApplicationParams implements Encodable {
|
|
|
1932
2203
|
this.globalState = globalState;
|
|
1933
2204
|
this.globalStateSchema = globalStateSchema;
|
|
1934
2205
|
this.localStateSchema = localStateSchema;
|
|
2206
|
+
this.sizeSponsor =
|
|
2207
|
+
typeof sizeSponsor === 'string'
|
|
2208
|
+
? Address.fromString(sizeSponsor)
|
|
2209
|
+
: sizeSponsor;
|
|
1935
2210
|
this.version =
|
|
1936
2211
|
typeof version === 'undefined' ? undefined : ensureSafeInteger(version);
|
|
1937
2212
|
}
|
|
@@ -1965,6 +2240,12 @@ export class ApplicationParams implements Encodable {
|
|
|
1965
2240
|
? this.localStateSchema.toEncodingData()
|
|
1966
2241
|
: undefined,
|
|
1967
2242
|
],
|
|
2243
|
+
[
|
|
2244
|
+
'size-sponsor',
|
|
2245
|
+
typeof this.sizeSponsor !== 'undefined'
|
|
2246
|
+
? this.sizeSponsor.toString()
|
|
2247
|
+
: undefined,
|
|
2248
|
+
],
|
|
1968
2249
|
['version', this.version],
|
|
1969
2250
|
]);
|
|
1970
2251
|
}
|
|
@@ -1996,6 +2277,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1996
2277
|
data.get('local-state-schema')
|
|
1997
2278
|
)
|
|
1998
2279
|
: undefined,
|
|
2280
|
+
sizeSponsor: data.get('size-sponsor'),
|
|
1999
2281
|
version: data.get('version'),
|
|
2000
2282
|
});
|
|
2001
2283
|
}
|
|
@@ -2216,7 +2498,7 @@ export class Asset implements Encodable {
|
|
|
2216
2498
|
{ key: 'index', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
2217
2499
|
{
|
|
2218
2500
|
key: 'params',
|
|
2219
|
-
valueSchema: AssetParams.encodingSchema,
|
|
2501
|
+
valueSchema: new OptionalSchema(AssetParams.encodingSchema),
|
|
2220
2502
|
omitEmpty: true,
|
|
2221
2503
|
}
|
|
2222
2504
|
);
|
|
@@ -2235,7 +2517,7 @@ export class Asset implements Encodable {
|
|
|
2235
2517
|
* Definition:
|
|
2236
2518
|
* data/transactions/asset.go : AssetParams
|
|
2237
2519
|
*/
|
|
2238
|
-
public params
|
|
2520
|
+
public params?: AssetParams;
|
|
2239
2521
|
|
|
2240
2522
|
/**
|
|
2241
2523
|
* Creates a new `Asset` object.
|
|
@@ -2250,7 +2532,7 @@ export class Asset implements Encodable {
|
|
|
2250
2532
|
params,
|
|
2251
2533
|
}: {
|
|
2252
2534
|
index: number | bigint;
|
|
2253
|
-
params
|
|
2535
|
+
params?: AssetParams;
|
|
2254
2536
|
}) {
|
|
2255
2537
|
this.index = ensureBigInt(index);
|
|
2256
2538
|
this.params = params;
|
|
@@ -2264,7 +2546,12 @@ export class Asset implements Encodable {
|
|
|
2264
2546
|
toEncodingData(): Map<string, unknown> {
|
|
2265
2547
|
return new Map<string, unknown>([
|
|
2266
2548
|
['index', this.index],
|
|
2267
|
-
[
|
|
2549
|
+
[
|
|
2550
|
+
'params',
|
|
2551
|
+
typeof this.params !== 'undefined'
|
|
2552
|
+
? this.params.toEncodingData()
|
|
2553
|
+
: undefined,
|
|
2554
|
+
],
|
|
2268
2555
|
]);
|
|
2269
2556
|
}
|
|
2270
2557
|
|
|
@@ -2274,7 +2561,10 @@ export class Asset implements Encodable {
|
|
|
2274
2561
|
}
|
|
2275
2562
|
return new Asset({
|
|
2276
2563
|
index: data.get('index'),
|
|
2277
|
-
params:
|
|
2564
|
+
params:
|
|
2565
|
+
typeof data.get('params') !== 'undefined'
|
|
2566
|
+
? AssetParams.fromEncodingData(data.get('params'))
|
|
2567
|
+
: undefined,
|
|
2278
2568
|
});
|
|
2279
2569
|
}
|
|
2280
2570
|
}
|
|
@@ -3189,11 +3479,14 @@ export class BoxDescriptor implements Encodable {
|
|
|
3189
3479
|
static get encodingSchema(): Schema {
|
|
3190
3480
|
if (!this.encodingSchemaValue) {
|
|
3191
3481
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3192
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3193
|
-
key: 'name',
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3482
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3483
|
+
{ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true },
|
|
3484
|
+
{
|
|
3485
|
+
key: 'value',
|
|
3486
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
3487
|
+
omitEmpty: true,
|
|
3488
|
+
}
|
|
3489
|
+
);
|
|
3197
3490
|
}
|
|
3198
3491
|
return this.encodingSchemaValue;
|
|
3199
3492
|
}
|
|
@@ -3203,12 +3496,27 @@ export class BoxDescriptor implements Encodable {
|
|
|
3203
3496
|
*/
|
|
3204
3497
|
public name: Uint8Array;
|
|
3205
3498
|
|
|
3499
|
+
/**
|
|
3500
|
+
* Base64 encoded box value. Present only when the `values` query parameter is set
|
|
3501
|
+
* to true.
|
|
3502
|
+
*/
|
|
3503
|
+
public value?: Uint8Array;
|
|
3504
|
+
|
|
3206
3505
|
/**
|
|
3207
3506
|
* Creates a new `BoxDescriptor` object.
|
|
3208
3507
|
* @param name - Base64 encoded box name
|
|
3508
|
+
* @param value - Base64 encoded box value. Present only when the `values` query parameter is set
|
|
3509
|
+
* to true.
|
|
3209
3510
|
*/
|
|
3210
|
-
constructor({
|
|
3511
|
+
constructor({
|
|
3512
|
+
name,
|
|
3513
|
+
value,
|
|
3514
|
+
}: {
|
|
3515
|
+
name: string | Uint8Array;
|
|
3516
|
+
value?: string | Uint8Array;
|
|
3517
|
+
}) {
|
|
3211
3518
|
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
3519
|
+
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
3212
3520
|
}
|
|
3213
3521
|
|
|
3214
3522
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -3217,7 +3525,10 @@ export class BoxDescriptor implements Encodable {
|
|
|
3217
3525
|
}
|
|
3218
3526
|
|
|
3219
3527
|
toEncodingData(): Map<string, unknown> {
|
|
3220
|
-
return new Map<string, unknown>([
|
|
3528
|
+
return new Map<string, unknown>([
|
|
3529
|
+
['name', this.name],
|
|
3530
|
+
['value', this.value],
|
|
3531
|
+
]);
|
|
3221
3532
|
}
|
|
3222
3533
|
|
|
3223
3534
|
static fromEncodingData(data: unknown): BoxDescriptor {
|
|
@@ -3226,6 +3537,7 @@ export class BoxDescriptor implements Encodable {
|
|
|
3226
3537
|
}
|
|
3227
3538
|
return new BoxDescriptor({
|
|
3228
3539
|
name: data.get('name'),
|
|
3540
|
+
value: data.get('value'),
|
|
3229
3541
|
});
|
|
3230
3542
|
}
|
|
3231
3543
|
}
|
|
@@ -3297,7 +3609,7 @@ export class BoxReference implements Encodable {
|
|
|
3297
3609
|
}
|
|
3298
3610
|
|
|
3299
3611
|
/**
|
|
3300
|
-
*
|
|
3612
|
+
* Boxes of an application
|
|
3301
3613
|
*/
|
|
3302
3614
|
export class BoxesResponse implements Encodable {
|
|
3303
3615
|
private static encodingSchemaValue: Schema | undefined;
|
|
@@ -3305,23 +3617,62 @@ export class BoxesResponse implements Encodable {
|
|
|
3305
3617
|
static get encodingSchema(): Schema {
|
|
3306
3618
|
if (!this.encodingSchemaValue) {
|
|
3307
3619
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3308
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3620
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3621
|
+
{
|
|
3622
|
+
key: 'boxes',
|
|
3623
|
+
valueSchema: new ArraySchema(BoxDescriptor.encodingSchema),
|
|
3624
|
+
omitEmpty: true,
|
|
3625
|
+
},
|
|
3626
|
+
{
|
|
3627
|
+
key: 'next-token',
|
|
3628
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
3629
|
+
omitEmpty: true,
|
|
3630
|
+
},
|
|
3631
|
+
{
|
|
3632
|
+
key: 'round',
|
|
3633
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3634
|
+
omitEmpty: true,
|
|
3635
|
+
}
|
|
3636
|
+
);
|
|
3313
3637
|
}
|
|
3314
3638
|
return this.encodingSchemaValue;
|
|
3315
3639
|
}
|
|
3316
3640
|
|
|
3317
3641
|
public boxes: BoxDescriptor[];
|
|
3318
3642
|
|
|
3643
|
+
/**
|
|
3644
|
+
* Used for pagination, when making another request provide this token with the
|
|
3645
|
+
* next parameter. The next token is the box name to use as the pagination cursor,
|
|
3646
|
+
* encoded in the goal app call arg form.
|
|
3647
|
+
*/
|
|
3648
|
+
public nextToken?: string;
|
|
3649
|
+
|
|
3650
|
+
/**
|
|
3651
|
+
* The round for which this information is relevant.
|
|
3652
|
+
*/
|
|
3653
|
+
public round?: number;
|
|
3654
|
+
|
|
3319
3655
|
/**
|
|
3320
3656
|
* Creates a new `BoxesResponse` object.
|
|
3321
3657
|
* @param boxes -
|
|
3658
|
+
* @param nextToken - Used for pagination, when making another request provide this token with the
|
|
3659
|
+
* next parameter. The next token is the box name to use as the pagination cursor,
|
|
3660
|
+
* encoded in the goal app call arg form.
|
|
3661
|
+
* @param round - The round for which this information is relevant.
|
|
3322
3662
|
*/
|
|
3323
|
-
constructor({
|
|
3663
|
+
constructor({
|
|
3664
|
+
boxes,
|
|
3665
|
+
nextToken,
|
|
3666
|
+
round,
|
|
3667
|
+
}: {
|
|
3668
|
+
boxes: BoxDescriptor[];
|
|
3669
|
+
nextToken?: string;
|
|
3670
|
+
round?: number | bigint;
|
|
3671
|
+
}) {
|
|
3324
3672
|
this.boxes = boxes;
|
|
3673
|
+
this.nextToken = nextToken;
|
|
3674
|
+
this.round =
|
|
3675
|
+
typeof round === 'undefined' ? undefined : ensureSafeInteger(round);
|
|
3325
3676
|
}
|
|
3326
3677
|
|
|
3327
3678
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -3332,6 +3683,8 @@ export class BoxesResponse implements Encodable {
|
|
|
3332
3683
|
toEncodingData(): Map<string, unknown> {
|
|
3333
3684
|
return new Map<string, unknown>([
|
|
3334
3685
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
3686
|
+
['next-token', this.nextToken],
|
|
3687
|
+
['round', this.round],
|
|
3335
3688
|
]);
|
|
3336
3689
|
}
|
|
3337
3690
|
|
|
@@ -3343,6 +3696,8 @@ export class BoxesResponse implements Encodable {
|
|
|
3343
3696
|
boxes: (data.get('boxes') ?? []).map((v: unknown) =>
|
|
3344
3697
|
BoxDescriptor.fromEncodingData(v)
|
|
3345
3698
|
),
|
|
3699
|
+
nextToken: data.get('next-token'),
|
|
3700
|
+
round: data.get('round'),
|
|
3346
3701
|
});
|
|
3347
3702
|
}
|
|
3348
3703
|
}
|
|
@@ -8039,6 +8394,11 @@ export class SupplyResponse implements Encodable {
|
|
|
8039
8394
|
valueSchema: new Uint64Schema(),
|
|
8040
8395
|
omitEmpty: true,
|
|
8041
8396
|
},
|
|
8397
|
+
{
|
|
8398
|
+
key: 'online-stake',
|
|
8399
|
+
valueSchema: new Uint64Schema(),
|
|
8400
|
+
omitEmpty: true,
|
|
8401
|
+
},
|
|
8042
8402
|
{ key: 'total-money', valueSchema: new Uint64Schema(), omitEmpty: true }
|
|
8043
8403
|
);
|
|
8044
8404
|
}
|
|
@@ -8051,10 +8411,18 @@ export class SupplyResponse implements Encodable {
|
|
|
8051
8411
|
public currentRound: bigint;
|
|
8052
8412
|
|
|
8053
8413
|
/**
|
|
8054
|
-
*
|
|
8414
|
+
* Total stake held by accounts with status Online at current_round, including
|
|
8415
|
+
* those whose participation keys have expired but have not yet been marked
|
|
8416
|
+
* offline.
|
|
8055
8417
|
*/
|
|
8056
8418
|
public onlineMoney: bigint;
|
|
8057
8419
|
|
|
8420
|
+
/**
|
|
8421
|
+
* Online stake used by agreement to vote for current_round, excluding accounts
|
|
8422
|
+
* whose participation keys have expired.
|
|
8423
|
+
*/
|
|
8424
|
+
public onlineStake: bigint;
|
|
8425
|
+
|
|
8058
8426
|
/**
|
|
8059
8427
|
* TotalMoney
|
|
8060
8428
|
*/
|
|
@@ -8063,20 +8431,27 @@ export class SupplyResponse implements Encodable {
|
|
|
8063
8431
|
/**
|
|
8064
8432
|
* Creates a new `SupplyResponse` object.
|
|
8065
8433
|
* @param currentRound - Round
|
|
8066
|
-
* @param onlineMoney -
|
|
8434
|
+
* @param onlineMoney - Total stake held by accounts with status Online at current_round, including
|
|
8435
|
+
* those whose participation keys have expired but have not yet been marked
|
|
8436
|
+
* offline.
|
|
8437
|
+
* @param onlineStake - Online stake used by agreement to vote for current_round, excluding accounts
|
|
8438
|
+
* whose participation keys have expired.
|
|
8067
8439
|
* @param totalMoney - TotalMoney
|
|
8068
8440
|
*/
|
|
8069
8441
|
constructor({
|
|
8070
8442
|
currentRound,
|
|
8071
8443
|
onlineMoney,
|
|
8444
|
+
onlineStake,
|
|
8072
8445
|
totalMoney,
|
|
8073
8446
|
}: {
|
|
8074
8447
|
currentRound: number | bigint;
|
|
8075
8448
|
onlineMoney: number | bigint;
|
|
8449
|
+
onlineStake: number | bigint;
|
|
8076
8450
|
totalMoney: number | bigint;
|
|
8077
8451
|
}) {
|
|
8078
8452
|
this.currentRound = ensureBigInt(currentRound);
|
|
8079
8453
|
this.onlineMoney = ensureBigInt(onlineMoney);
|
|
8454
|
+
this.onlineStake = ensureBigInt(onlineStake);
|
|
8080
8455
|
this.totalMoney = ensureBigInt(totalMoney);
|
|
8081
8456
|
}
|
|
8082
8457
|
|
|
@@ -8089,6 +8464,7 @@ export class SupplyResponse implements Encodable {
|
|
|
8089
8464
|
return new Map<string, unknown>([
|
|
8090
8465
|
['current_round', this.currentRound],
|
|
8091
8466
|
['online-money', this.onlineMoney],
|
|
8467
|
+
['online-stake', this.onlineStake],
|
|
8092
8468
|
['total-money', this.totalMoney],
|
|
8093
8469
|
]);
|
|
8094
8470
|
}
|
|
@@ -8100,6 +8476,7 @@ export class SupplyResponse implements Encodable {
|
|
|
8100
8476
|
return new SupplyResponse({
|
|
8101
8477
|
currentRound: data.get('current_round'),
|
|
8102
8478
|
onlineMoney: data.get('online-money'),
|
|
8479
|
+
onlineStake: data.get('online-stake'),
|
|
8103
8480
|
totalMoney: data.get('total-money'),
|
|
8104
8481
|
});
|
|
8105
8482
|
}
|
|
@@ -8360,8 +8737,8 @@ export class TransactionParametersResponse implements Encodable {
|
|
|
8360
8737
|
public lastRound: bigint;
|
|
8361
8738
|
|
|
8362
8739
|
/**
|
|
8363
|
-
* The minimum transaction fee (not per byte) required for the
|
|
8364
|
-
*
|
|
8740
|
+
* The minimum transaction fee (not per byte) required for the txn to validate for
|
|
8741
|
+
* the current network protocol.
|
|
8365
8742
|
*/
|
|
8366
8743
|
public minFee: bigint;
|
|
8367
8744
|
|
|
@@ -8376,8 +8753,8 @@ export class TransactionParametersResponse implements Encodable {
|
|
|
8376
8753
|
* @param genesisHash - GenesisHash is the hash of the genesis block.
|
|
8377
8754
|
* @param genesisId - GenesisID is an ID listed in the genesis block.
|
|
8378
8755
|
* @param lastRound - LastRound indicates the last round seen
|
|
8379
|
-
* @param minFee - The minimum transaction fee (not per byte) required for the
|
|
8380
|
-
*
|
|
8756
|
+
* @param minFee - The minimum transaction fee (not per byte) required for the txn to validate for
|
|
8757
|
+
* the current network protocol.
|
|
8381
8758
|
*/
|
|
8382
8759
|
constructor({
|
|
8383
8760
|
consensusVersion,
|