所以基本上我是想弄到账户信息。
方法:Algodv2accountInformation,
返回AccountInformation类型,但在调用.do()之后
.i.e
Algodv2accountInformation.do()返回类型是更通用的。
<Promise<Record<string, any>>什么是正确的方式来进行这个api调用,但让它返回正确的信息。
<AccountInformation>
发布于 2022-08-08 11:09:08
我刚检查了他们的文档,因为docs说它返回了
<AccountInformation>

<AccountInformation>正在封装请求,而不是响应。
您所能做的是利用类,因为它扩展了基类,它使用Record作为输入。
因此,您从运行.do()时获得的JSON。
accountInformation(account.addr).do():
{
address: 'LFNDB6ADWN7M3HFA7TSBKW4ZV7Q3TAJ2TWAGHH35WFGQAVGTJGFVJXQASI',
amount: 10000000,
'amount-without-pending-rewards': 10000000,
'apps-local-state': [],
'apps-total-schema': { 'num-byte-slice': 0, 'num-uint': 0 },
assets: [],
'created-apps': [],
'created-assets': [],
'min-balance': 100000,
'pending-rewards': 0,
'reward-base': 0,
rewards: 0,
round: 32,
status: 'Offline',
'total-apps-opted-in': 0,
'total-assets-opted-in': 0,
'total-created-apps': 0,
'total-created-assets': 0
}可以将传递到帐户(Record),如下所示:
new algosdk.modelsv2.Account(info):
Account {
address: 'LFNDB6ADWN7M3HFA7TSBKW4ZV7Q3TAJ2TWAGHH35WFGQAVGTJGFVJXQASI',
amount: 10000000,
amountWithoutPendingRewards: undefined,
minBalance: undefined,
pendingRewards: undefined,
rewards: 0,
round: 32,
status: 'Offline',
totalAppsOptedIn: undefined,
totalAssetsOptedIn: undefined,
totalCreatedApps: undefined,
totalCreatedAssets: undefined,
appsLocalState: undefined,
appsTotalExtraPages: undefined,
appsTotalSchema: undefined,
assets: [],
authAddr: undefined,
createdApps: undefined,
createdAssets: undefined,
participation: undefined,
rewardBase: undefined,
sigType: undefined,
attribute_map: {
address: 'address',
amount: 'amount',
amountWithoutPendingRewards: 'amount-without-pending-rewards',
minBalance: 'min-balance',
pendingRewards: 'pending-rewards',
rewards: 'rewards',
round: 'round',
status: 'status',
totalAppsOptedIn: 'total-apps-opted-in',
totalAssetsOptedIn: 'total-assets-opted-in',
totalCreatedApps: 'total-created-apps',
totalCreatedAssets: 'total-created-assets',
appsLocalState: 'apps-local-state',
appsTotalExtraPages: 'apps-total-extra-pages',
appsTotalSchema: 'apps-total-schema',
assets: 'assets',
authAddr: 'auth-addr',
createdApps: 'created-apps',
createdAssets: 'created-assets',
participation: 'participation',
rewardBase: 'reward-base',
sigType: 'sig-type'
}
}和!沃利亚!你有你的账户模型对象!
实际上应该有一些方法.getModel(),我将创建一个PR,因为这应该是SDK的一部分。
https://stackoverflow.com/questions/73276736
复制相似问题