-
getAccountStatus
- このメソッドは、トークン・アカウントの現在のステータスを取得します。このメソッドは、チェーンコードの
Token Admin
またはトークン・アカウント所有者によってコールできます。
-
@Validator(yup.string(), yup.string(), yup.string())
public async getAccountStatus(orgId: string, userId: string, tokenId ?: string) {
const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
let tokenAccount = await this.Ctx.ERC1155Account.getAccount(userAccountId, tokenId);
await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT_STATUS.get", "TOKEN", { accountId: tokenAccount.accountId });
try {
return await this.Ctx.ERC1155AccountStatus.getAccountStatus(tokenAccount.accountId);
} catch (err) {
return await this.Ctx.ERC1155AccountStatus.getDefaultAccountStatus(tokenAccount.accountId);
}
}
- パラメータ:
orgId: string
- 現在の組織内のユーザーのメンバーシップ・サービス・プロバイダ(MSP) ID。
userId: string
- ユーザーのユーザー名または電子メールID。
tokenId ?: string
- 真でないトークン・アカウントの場合、空の文字列。楽しいトークン・アカウントの場合は、トークンID。
- 戻り値:
- 成功すると、トークン・アカウント・ステータスのJSON表現。アカウント・ステータス機能が使用可能になる前にアカウントが作成されたためにアカウントの元帳にステータスが見つからない場合、ステータスはレスポンスで
active
としてリストされます。
- 戻り値の例:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "active"
}
-
getAccountStatusHistory
- このメソッドは、アカウント・ステータスの履歴を取得します。このメソッドは、チェーンコードの
Token Admin
またはトークン・アカウント所有者によってコールできます。
-
public async getAccountStatusHistory(orgId: string, userId: string, tokenId ?: string) {
const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
let tokenAccount = await this.Ctx.ERC1155Account.getAccount(userAccountId, tokenId);
await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT_STATUS.history", "TOKEN", { accountId: tokenAccount.accountId });
const status_id = await this.Ctx.ERC1155AccountStatus.generateAccountStatusId(tokenAccount.accountId);
let accountStatusHistory: any;
try {
accountStatusHistory = await this.Ctx.ERC1155AccountStatus.history(status_id);
} catch (err) {
return [];
}
return accountStatusHistory;
}
- パラメータ:
orgId: string
- 現在の組織内のユーザーのメンバーシップ・サービス・プロバイダ(MSP) ID。
userId: string
- ユーザーのユーザー名または電子メールID。
tokenId ?: string
- 真でないトークン・アカウントの場合、空の文字列。楽しいトークン・アカウントの場合は、トークンID。
- 戻り値:
- 成功すると、JSON形式のアカウント・ステータス履歴が表示されます。
- 戻り値の例:
[
{
"trxId": "d5c6d6f601257ba9b6edaf5b7660f00adc13c37d5321b8f7d3a35afab2e93e63",
"timeStamp": "2022-12-02T10:39:14.000Z",
"value": {
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "suspended"
}
},
{
"trxId": "e6c850cfa084dc20ad95fb2bb8165eef3a3bd62a0ac867cccee57c2003125183",
"timeStamp": "2022-12-02T10:37:50.000Z",
"value": {
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "active"
}
}
]
-
activateAccount
- このメソッドは、トークン・アカウントをアクティブ化します。このメソッドは、チェーンコードの
Token Admin
によってのみコールできます。削除されたアカウントはアクティブ化できません。アカウント・ステータス機能が使用可能になる前に作成されたアカウントの場合は、このメソッドをコールして、アカウント・ステータスをactive
に設定する必要があります。
-
@Validator(yup.string(), yup.string(), yup.string())
public async activateAccount(orgId: string, userId: string, tokenId ?: string) {
await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT_STATUS.activateAccount", "TOKEN");
const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
let tokenAccount = await this.Ctx.ERC1155Account.getAccount(userAccountId, tokenId);
return await this.Ctx.ERC1155Account.activateAccount(tokenAccount.accountId);
}
- パラメータ:
orgId: string
- 現在の組織内のユーザーのメンバーシップ・サービス・プロバイダ(MSP) ID。
userId: string
- ユーザーのユーザー名または電子メールID。
tokenId ?: string
- 真でないトークン・アカウントの場合、空の文字列。楽しいトークン・アカウントの場合は、トークンID。
- 戻り値:
- 成功すると、トークン・アカウント・ステータスのJSON表現。
- 戻り値の例:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "active"
}
-
suspendAccount
- このメソッドは、トークン・アカウントを一時停止します。このメソッドは、チェーンコードの
Token Admin
によってのみコールできます。アカウントが一時停止された後は、アカウントを更新する操作を完了できません。削除されたアカウントは一時停止できません。
-
@Validator(yup.string(), yup.string(), yup.string())
public async suspendAccount(orgId: string, userId: string, tokenId ?: string) {
await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT_STATUS.suspendAccount", "TOKEN");
const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
let tokenAccount = await this.Ctx.ERC1155Account.getAccount(userAccountId, tokenId);
return await this.Ctx.ERC1155Account.suspendAccount(tokenAccount.accountId);
}
- パラメータ:
orgId: string
- 現在の組織内のユーザーのメンバーシップ・サービス・プロバイダ(MSP) ID。
userId: string
- ユーザーのユーザー名または電子メールID。
tokenId ?: string
- 真でないトークン・アカウントの場合、空の文字列。楽しいトークン・アカウントの場合は、トークンID。
- 戻り値:
- 成功すると、トークン・アカウント・ステータスのJSON表現。
- 戻り値の例:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "suspended"
}
-
deleteAccount
- このメソッドはトークン・アカウントを削除します。このメソッドは、チェーンコードの
Token Admin
によってのみコールできます。アカウントの削除後は、アカウントを更新する操作を完了できません。削除されたアカウントは最終状態であり、他の状態に変更できません。勘定科目を削除するには、勘定科目残高がゼロである必要があります。
-
@Validator(yup.string(), yup.string(), yup.string())
public async deleteAccount(orgId: string, userId: string, tokenId ?: string) {
await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155ACCOUNT_STATUS.deleteAccount", "TOKEN");
const userAccountId = this.Ctx.ERC1155Account.generateAccountId(orgId, userId, ACCOUNT_TYPE.USER_ACCOUNT);
let tokenAccount = await this.Ctx.ERC1155Account.getAccount(userAccountId, tokenId);
return await this.Ctx.ERC1155Account.deleteAccount(tokenAccount.accountId);
}
- パラメータ:
orgId: string
- 現在の組織内のユーザーのメンバーシップ・サービス・プロバイダ(MSP) ID。
userId: string
- ユーザーのユーザー名または電子メールID。
tokenId ?: string
- 真でないトークン・アカウントの場合、空の文字列。楽しいトークン・アカウントの場合は、トークンID。
- 戻り値:
- 成功すると、トークン・アカウント・ステータスのJSON表現。
- 戻り値の例:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "deleted"
}