Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: new sbtc network #5982

Merged
merged 2 commits into from
Nov 21, 2024
Merged

test: new sbtc network #5982

merged 2 commits into from
Nov 21, 2024

Conversation

kyranjamie
Copy link
Collaborator

@kyranjamie kyranjamie commented Nov 20, 2024

Try out Leather build 22aa41bExtension build, Test report, Storybook, Chromatic

This PR generates a build with the sBTC Testnet network, pointing to Stacks testnet and generating regtests addresses for https://beta.sbtc-mempool.tech/api/proxy

This needs to be modified in monorepo, but here for testing purposes

@kyranjamie kyranjamie force-pushed the demo/new-network branch 6 times, most recently from 0f4af50 to f692075 Compare November 20, 2024 18:59
@kyranjamie kyranjamie marked this pull request as ready for review November 20, 2024 18:59
@kyranjamie kyranjamie force-pushed the demo/new-network branch 2 times, most recently from 73926a4 to 14fa78a Compare November 20, 2024 19:42
@camerow
Copy link
Collaborator

camerow commented Nov 20, 2024

Anything specific I can help test here?

@setbern
Copy link

setbern commented Nov 20, 2024

Still running into Leather validation issue for sbtcTestnet

This is the code that i'm running

 const sendParams = {
          recipients: [
            {
              address: p2trAddress,
              amount: `${amount}`,
            },
          ],
          network: process.env.NEXT_PUBLIC_WALLET_NETWORK || "sbtcTestnet",
        };

process.env.NEXT_PUBLIC_WALLET_NETWORK is sbtcTestnet

p2trAddress = bcrt1pzxz00vdnc8j4rz6u9axp6jmh60f8v7t8zkmwzm4x3899fvvl78nseyz7r2

response "Validation error: Address is for incorrect network at "recipients""

@kyranjamie
Copy link
Collaborator Author

@setbern this is a different validation error, fixing now

@setbern
Copy link

setbern commented Nov 20, 2024

@kyranjamie If i comment out the following it works (probably involves what you pointed out)

export const rpcSendTransferParamsSchema = z
  .object({
    account: accountSchema.optional(),
    // works if i comment out the line below
    //network: defaultNetworksSchema.optional(),
    recipients: z
      .array(
        z.object({
          address: z.string(),
          amount: z.string().refine(value => checkIfDigitsOnly(value), {
            message: 'Sat denominated amounts only',
          }),
        })
      )
      .nonempty()
      .refine(
        recipients => {
          const inferredNetworksByAddress = recipients.map(({ address }) =>
            getNetworkTypeFromAddress(address)
          );
          return uniqueArray(inferredNetworksByAddress).length === 1;
        },
        { message: 'Cannot tranfer to addresses of different networks', path: ['recipients'] }
      ),
  })
  .refine(
    ({ network, recipients }) => {
      const addressNetworks = recipients.map(recipient =>
        btcAddressNetworkValidator(network as BitcoinNetworkModes).isValidSync(recipient.address)
      );

      return !addressNetworks.some(val => val === false);
    },
    { message: FormErrorMessages.IncorrectNetworkAddress, path: ['recipients'] }
  );

@kyranjamie
Copy link
Collaborator Author

@setbern fixed it, there was an illegal type cast here

btcAddressNetworkValidator(network as BitcoinNetworkModes) // was not BitcoinNetworkModes

@aldur
Copy link

aldur commented Nov 20, 2024

Tested this as well and confirming it works on my side too, thank you!

@kyranjamie kyranjamie added this pull request to the merge queue Nov 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2024
@kyranjamie kyranjamie enabled auto-merge (rebase) November 21, 2024 16:25
@kyranjamie kyranjamie merged commit 720fa86 into dev Nov 21, 2024
30 checks passed
@kyranjamie kyranjamie deleted the demo/new-network branch November 21, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants