Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions package-lock.json

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

67 changes: 66 additions & 1 deletion packages/connect/src/stories/ConnectPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { getSelectedProviderId } from '@stacks/connect-ui';
import {
AnchorMode,

Check failure on line 3 in packages/connect/src/stories/ConnectPage.tsx

View workflow job for this annotation

GitHub Actions / Code checks

'AnchorMode' is defined but never used
ClarityVersion,
makeUnsignedContractDeploy,
makeUnsignedSTXTokenTransfer,
} from '@stacks/transactions';
import { useReducer } from 'react';
import { disconnect, showConnect, showSignMessage } from '../ui';
import { disconnect, showConnect, showSignMessage, showSignTransaction } from '../ui';
import { bytesToHex } from '@stacks/common';

Check failure on line 10 in packages/connect/src/stories/ConnectPage.tsx

View workflow job for this annotation

GitHub Actions / Code checks

'bytesToHex' is defined but never used

export const ConnectPage = ({ children }: { children?: any }) => {
const refresh = useReducer(x => x + 1, 0)[1];
Expand Down Expand Up @@ -71,6 +78,64 @@
>
<code>disconnect()</code>
</button>

<hr />

<button
onClick={() => {
const run = async () => {
const tx = await makeUnsignedContractDeploy({
codeBody: `
(define-public (hello-world)
(ok "hello world"))
`,
contractName: 'hello-world',
publicKey: '024cce41b91566d70ec2ed6eb161c6ef9c277bdc034738318ed06f1d5ba09546d6', // account 1, example wallet
clarityVersion: ClarityVersion.Clarity3,
network: 'testnet',
});
const txHex = tx.serialize();
console.log('txHex', txHex);

showSignTransaction({
txHex,
onFinish: d => {
alert(JSON.stringify(d, null, 2));
},
onCancel: console.error,
});
};
run().catch(console.error);
}}
>
<code>txHex (contract deploy)</code>
</button>

<button
onClick={() => {
const run = async () => {
const tx = await makeUnsignedSTXTokenTransfer({
recipient: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM',
amount: '100000',
publicKey: '024cce41b91566d70ec2ed6eb161c6ef9c277bdc034738318ed06f1d5ba09546d6', // account 1, example wallet
network: 'testnet',
});
const txHex = tx.serialize();
console.log('txHex', txHex);

showSignTransaction({
txHex,
onFinish: d => {
alert(JSON.stringify(d, null, 2));
},
onCancel: console.error,
});
};
run().catch(console.error);
}}
>
<code>txHex (stx transfer)</code>
</button>
</div>

{children}
Expand Down
Loading