アカウントの制限リストの取得
アカウント制限でスパム攻撃を防止する ガイドを完了している
// replace with address
const rawAddress = 'TAEG6L-KWXRA7-PSWUEE-ILQPG4-3V5CYZ-S5652T-JTUU';
const address = Address.createFromRawAddress(rawAddress);
// replace with node endpoint
const nodeUrl = 'NODE_URL';
const repositoryFactory = new RepositoryFactoryHttp(nodeUrl);
const restrictionHttp = repositoryFactory.createRestrictionAccountRepository();
restrictionHttp.getAccountRestrictions(address).subscribe(
(accountRestrictions: any) => {
if (accountRestrictions.length > 0) {
accountRestrictions
.filter(
(accountRestriction: any) => accountRestriction.values.length > 0,
)
.map((accountRestriction: any) => {
console.log(
'\n',
accountRestriction.restrictionFlags,
accountRestriction.values.toString(),
);
});
} else {
console.log('The address does not have account restriction assigned.');
}
},
(err) => console.log(err),
);
// replace with address
const rawAddress = 'TAEG6L-KWXRA7-PSWUEE-ILQPG4-3V5CYZ-S5652T-JTUU';
const address = symbol_sdk_1.Address.createFromRawAddress(rawAddress);
// replace with node endpoint
const nodeUrl = 'NODE_URL';
const repositoryFactory = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const restrictionHttp = repositoryFactory.createRestrictionAccountRepository();
restrictionHttp.getAccountRestrictions(address).subscribe(
(accountRestrictions) => {
if (accountRestrictions.length > 0) {
accountRestrictions
.filter((accountRestriction) => accountRestriction.values.length > 0)
.map((accountRestriction) => {
console.log(
'\n',
accountRestriction.restrictionFlags,
accountRestriction.values.toString(),
);
});
} else {
console.log('The address does not have account restriction assigned.');
}
},
(err) => console.log(err),
);
// replace with node endpoint
try (final RepositoryFactory repositoryFactory = new RepositoryFactoryVertxImpl(
"NODE_URL")) {
final RestrictionAccountRepository restrictionRepository = repositoryFactory
.createRestrictionAccountRepository();
// replace with address
final String rawAddress = "TAEG6L-KWXRA7-PSWUEE-ILQPG4-3V5CYZ-S5652T-JTUU";
final Address address = Address.createFromRawAddress(rawAddress);
final AccountRestrictions restrictions = restrictionRepository
.getAccountRestrictions(address)
.toFuture().get();
final JsonHelper helper = new JsonHelperJackson2();
System.out.println(helper.prettyPrint(restrictions));
}