アドレスにアカウント制限をアタッチする

アカウントの制限リストの取得

前提条件

方法 #01: SDK を使用する

// 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));
        }

方法 #02: CLI を使用する

symbol-cli restriction account --address TAEG6L-KWXRA7-PSWUEE-ILQPG4-3V5CYZ-S5652T-JTUU