Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"url": "git+https://github.com/friedger/stacks-send-many.git"
},
"dependencies": {
"@scure/bip32": "^1.7.0",
"@scure/btc-signer": "^1.8.1",
"@stacks/blockchain-api-client": "^8.13.5",
"@stacks/common": "7.3.1",
"@stacks/connect": "^8.2.3",
Expand All @@ -28,6 +26,7 @@
"@walletconnect/types": "^2.23.1",
"@walletconnect/utils": "^2.23.1",
"c32check": "^2.0.0",
"clarity-abitype": "0.3.0",
"global": "^4.4.0",
"jdenticon": "^3.3.0",
"jotai": "^2.16.0",
Expand Down
32 changes: 26 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/components/Address.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ClarityType } from '@stacks/transactions';
import toUnicode from 'punycode2/to-unicode';
import { useEffect, useMemo, useState } from 'react';
import { hex_to_ascii } from '../lib/string-utils';
Expand All @@ -16,9 +15,8 @@ export function Address({ addr }: { addr: string }) {

useEffect(() => {
getNameFromAddress(addr).then(data => {
if (data.type === ClarityType.ResponseOk && data.value.type === ClarityType.OptionalSome) {
const { name, namespace } = data.value.value.value;

if (data.ok) {
const { name, namespace } = data.ok;
const nameStr = hex_to_ascii(name.value);
const namePunycodeStr = toUnicode(nameStr);
const namespaceStr = hex_to_ascii(namespace.value);
Expand Down
14 changes: 7 additions & 7 deletions src/components/SBTCInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { cvToString, fetchCallReadOnlyFunction, PrincipalCV, TupleCV } from '@stacks/transactions';
import { useEffect, useState } from 'react';
import { typedCallReadOnlyFunction } from 'clarity-abitype';
import { NETWORK } from '../lib/constants';
import { sbtcRegistryAbi } from '../lib/abi';

export function SBTCInfo({ assetId }: { assetId: string }) {
const [info, setInfo] = useState<string>();
Expand All @@ -9,17 +10,16 @@ export function SBTCInfo({ assetId }: { assetId: string }) {
const fn = async () => {
const [contractId, _] = assetId.split('::');
const [contractAddress] = contractId.split('.');
const response = (await fetchCallReadOnlyFunction({
const response = await typedCallReadOnlyFunction({
abi: sbtcRegistryAbi,
contractAddress,
contractName: 'sbtc-registry',
functionName: 'get-current-signer-data',
functionArgs: [],
senderAddress: contractAddress,
network: NETWORK,
})) as TupleCV<{ 'current-signer-principal': PrincipalCV }>;
setInfo(
`Current sBTC signer Stacks address: ${cvToString(response.value['current-signer-principal'])}`
);
});

setInfo(`Current sBTC signer Stacks address: ${response['current-signer-principal']}`);
};
fn().catch(e => {
setInfo(`Failed to load signer data. (${e.message})`);
Expand Down
4 changes: 2 additions & 2 deletions src/components/SendManyInputContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const addToCVValues = async <T extends Row>(parts: T[]) => {
} catch (e) {
try {
const owner = await getNameInfo(toAscii(p.to));
if (owner.type === ClarityType.OptionalSome) {
return { ...p, toCV: owner.value.value.owner };
if (owner?.owner) {
return { ...p, toCV: owner.owner };
} else {
return { ...p, error: `No address for ${p.to}` };
}
Expand Down
Loading