-
getAccountStatus
- 이 메소드는 토큰 계정의 현재 상태를 가져옵니다. 이 메소드는 체인 코드의
Token Admin
또는 토큰 계정 소유자가 호출할 수 있습니다.
-
@Validator(yup.string(), yup.string())
public async getAccountStatus(orgId: string, userId: string) {
const accountId = await this.Ctx.ERC721Account.generateAccountId(orgId, userId);
await this.Ctx.ERC721Auth.checkAuthorization("ERC721ACCOUNT_STATUS.get", "TOKEN", { accountId });
try {
return await this.Ctx.ERC721AccountStatus.getAccountStatus(accountId);
} catch (err) {
return await this.Ctx.ERC721AccountStatus.getDefaultAccountStatus(accountId);
}
}
- 매개변수:
orgId: string
- 현재 조직에 있는 사용자의 멤버쉽 서비스 제공자(MSP) ID입니다.
userId: string
- 사용자의 사용자 이름 또는 전자메일 ID입니다.
- 반환값:
- 성공 시 토큰 계정 상태의 JSON 표현입니다. 계정 상태 기능을 사용할 수 있기 전에 계정이 생성되었으므로 계정에 대한 원장에서 상태를 찾을 수 없는 경우 응답에 상태가
active
로 나열됩니다.
- 반환 값 예제:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "active"
}
-
getAccountStatusHistory
- 이 방법은 계정 상태 기록을 가져옵니다. 이 메소드는 체인 코드의
Token Admin
또는 토큰 계정 소유자가 호출할 수 있습니다.
-
public async getAccountStatusHistory(orgId: string, userId: string) {
const accountId = await this.Ctx.ERC721Account.generateAccountId(orgId, userId);
await this.Ctx.ERC721Account.getAccount(accountId);
await this.Ctx.ERC721Auth.checkAuthorization("ERC721ACCOUNT_STATUS.history", "TOKEN", { accountId });
const status_id = await this.Ctx.ERC721AccountStatus.generateAccountStatusId(accountId);
let accountStatusHistory: any;
try {
accountStatusHistory = await this.Ctx.ERC721AccountStatus.history(status_id);
} catch (err) {
return [];
}
return accountStatusHistory;
}
- 매개변수:
orgId: string
- 현재 조직에 있는 사용자의 멤버쉽 서비스 제공자(MSP) ID입니다.
userId: 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())
public async activateAccount(orgId: string, userId: string) {
await this.Ctx.ERC721Auth.checkAuthorization("ERC721ACCOUNT_STATUS.activateAccount", "TOKEN");
const accountId = await this.Ctx.ERC721Account.generateAccountId(orgId, userId);
return await this.Ctx.ERC721Account.activateAccount(accountId);
}
- 매개변수:
orgId: string
- 현재 조직에 있는 사용자의 멤버쉽 서비스 제공자(MSP) ID입니다.
userId: string
- 사용자의 사용자 이름 또는 전자메일 ID입니다.
- 반환값:
- 성공 시 토큰 계정 상태의 JSON 표현입니다.
- 반환 값 예제:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "active"
}
-
suspendAccount
- 이 메소드는 토큰 계정을 일시 중지합니다. 이 메소드는 체인 코드의
Token Admin
로만 호출할 수 있습니다. 계정이 일시 중지된 후에는 계정 업데이트 작업을 완료할 수 없습니다. 삭제된 계정은 일시 중지할 수 없습니다.
-
@Validator(yup.string(), yup.string())
public async suspendAccount(orgId: string, userId: string) {
await this.Ctx.ERC721Auth.checkAuthorization("ERC721ACCOUNT_STATUS.suspendAccount", "TOKEN");
const accountId = await this.Ctx.ERC721Account.generateAccountId(orgId, userId);
return await this.Ctx.ERC721Account.suspendAccount(accountId);
}
- 매개변수:
orgId: string
- 현재 조직에 있는 사용자의 멤버쉽 서비스 제공자(MSP) ID입니다.
userId: string
- 사용자의 사용자 이름 또는 전자메일 ID입니다.
- 반환값:
- 성공 시 토큰 계정 상태의 JSON 표현입니다.
- 반환 값 예제:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "suspended"
}
-
deleteAccount
- 이 메소드는 토큰 계정을 삭제합니다. 이 메소드는 체인 코드의
Token Admin
로만 호출할 수 있습니다. 계정이 삭제된 후에는 계정 업데이트 작업을 완료할 수 없습니다. 삭제된 계정은 최종 상태이므로 다른 상태로 변경할 수 없습니다. 계정을 삭제하려면 계정 잔액이 0이어야 합니다.
-
@Validator(yup.string(), yup.string())
public async deleteAccount(orgId: string, userId: string) {
await this.Ctx.ERC721Auth.checkAuthorization("ERC721ACCOUNT_STATUS.deleteAccount", "TOKEN");
const accountId = await this.Ctx.ERC721Account.generateAccountId(orgId, userId);
return await this.Ctx.ERC721Account.deleteAccount(accountId);
}
- 매개변수:
orgId: string
- 현재 조직에 있는 사용자의 멤버쉽 서비스 제공자(MSP) ID입니다.
userId: string
- 사용자의 사용자 이름 또는 전자메일 ID입니다.
- 반환값:
- 성공 시 토큰 계정 상태의 JSON 표현입니다.
- 반환 값 예제:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "deleted"
}