Obtenga la lista de restricciones de la cuenta.
Guía preventing spam attacks with account restrictions completa.
// replace with address
const rawAddress = 'BXRG6L-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 = 'BXRG6L-KWXRA7-PSWUEE-ILQPG4-3V5CYZ-S5652T-JTUU';
const address = bitxor_sdk_1.Address.createFromRawAddress(rawAddress);
// replace with node endpoint
const nodeUrl = 'NODE_URL';
const repositoryFactory = new bitxor_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 = "BXRG6L-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));
}
bitxor-cli restriction account --address BXRG6L-KWXRA7-PSWUEE-ILQPG4-3V5CYZ-S5652T-JTUU