Browse Source

fix: more explicit callout for mainnet network

feat/new-clarity-onboarding
Hank Stoever 4 years ago
parent
commit
61074bf60d
  1. 42
      src/pages/build-apps/guides/transaction-signing.md

42
src/pages/build-apps/guides/transaction-signing.md

@ -65,14 +65,11 @@ Call the `openSTXTransfer` function provided by the `connect` package to trigger
import { openSTXTransfer } from '@stacks/connect'; import { openSTXTransfer } from '@stacks/connect';
import { StacksTestnet } from '@stacks/network'; import { StacksTestnet } from '@stacks/network';
const network = new StacksTestnet();
openSTXTransfer({ openSTXTransfer({
recipient: 'ST2EB9WEQNR9P0K28D2DC352TM75YG3K0GT7V13CV', recipient: 'ST2EB9WEQNR9P0K28D2DC352TM75YG3K0GT7V13CV',
amount: '100', amount: '100',
memo: 'Reimbursement', memo: 'Reimbursement',
authOrigin, network: new StacksTestnet(), // for mainnet, `new StacksMainnet()`
network,
appDetails: { appDetails: {
name: 'My App', name: 'My App',
icon: window.location.origin + '/my-app-logo.svg', icon: window.location.origin + '/my-app-logo.svg',
@ -92,7 +89,6 @@ interface STXTransferOptions {
recipient: string; recipient: string;
amount: string; amount: string;
memo?: string; memo?: string;
authOrigin?: string;
network: StacksNetwork; network: StacksNetwork;
appDetails: { appDetails: {
name: string; name: string;
@ -102,15 +98,14 @@ interface STXTransferOptions {
} }
``` ```
| parameter | type | required | description | | parameter | type | required | description |
| ---------- | ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------- | ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| recipient | string | true | STX address for recipient of transfer | | recipient | string | true | STX address for recipient of transfer |
| amount | string | true | Amount of microstacks (1 STX = 1,000,000 microstacks) to be transferred provided as string to prevent floating point errors. | | amount | string | true | Amount of microstacks (1 STX = 1,000,000 microstacks) to be transferred provided as string to prevent floating point errors. |
| appDetails | object | true | Dictionary that requires `name` and `icon` for app | | appDetails | object | true | Dictionary that requires `name` and `icon` for app |
| onFinish | function | true | Callback executed by app when transaction has been signed and broadcasted. [Read more](#onFinish-option) | | onFinish | function | true | Callback executed by app when transaction has been signed and broadcasted. [Read more](#onFinish-option) |
| memo | string | false | Optional memo for inclusion with transaction | | memo | string | false | Optional memo for inclusion with transaction |
| authOrigin | string | false | URL of authenticator to use for prompting signature and broadcast. Defaults to `https://wallet.hiro.so` for the Stacks Wallet, which is handled by the Stacks Wallet browser extension if installed. | | network | StacksNetwork | false | Specify the network that this transaction should be completed on. [Read more](#network-option) |
| network | StacksNetwork | false | Specify the network that this transaction should be completed on. [Read more](#network-option) |
## Prompt to deploy smart contract ## Prompt to deploy smart contract
@ -142,7 +137,6 @@ Several parameters are available for calling `openContractDeploy`. Here's the ex
interface ContractDeployOptions { interface ContractDeployOptions {
codeBody: string; codeBody: string;
contractName: string; contractName: string;
authOrigin?: string;
network: StacksNetwork; network: StacksNetwork;
appDetails: { appDetails: {
name: string; name: string;
@ -152,14 +146,13 @@ interface ContractDeployOptions {
} }
``` ```
| parameter | type | required | description | | parameter | type | required | description |
| ------------ | ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------ | ------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| codeBody | string | true | Clarity source code for contract | | codeBody | string | true | Clarity source code for contract |
| contractName | string | true | Name for contract | | contractName | string | true | Name for contract |
| appDetails | object | true | Dictionary that requires `name` and `icon` for app | | appDetails | object | true | Dictionary that requires `name` and `icon` for app |
| onFinish | function | true | Callback executed by app when transaction has been signed and broadcasted. [Read more](#onFinish-option) | | onFinish | function | true | Callback executed by app when transaction has been signed and broadcasted. [Read more](#onFinish-option) |
| authOrigin | string | false | URL of authenticator to use for prompting signature and broadcast. Defaults to `https://wallet.hiro.so` for the Stacks Wallet, which is handled by the Stacks Wallet browser extension if installed. | | network | StacksNetwork | false | Specify the network that this transaction should be completed on. [Read more](#network-option) |
| network | StacksNetwork | false | Specify the network that this transaction should be completed on. [Read more](#network-option) |
-> Contracts will deploy to the Stacks address of the authenticated user. -> Contracts will deploy to the Stacks address of the authenticated user.
@ -213,7 +206,6 @@ const options = {
contractName: 'my-contract', contractName: 'my-contract',
functionName: 'my-func', functionName: 'my-func',
functionArgs, functionArgs,
authOrigin,
appDetails: { appDetails: {
name: 'My App', name: 'My App',
icon: window.location.origin + '/my-app-logo.svg', icon: window.location.origin + '/my-app-logo.svg',
@ -237,7 +229,6 @@ interface ContractCallOptions {
contractName: string; contractName: string;
functionArgs?: ClarityValue[]; functionArgs?: ClarityValue[];
network: StacksNetwork; network: StacksNetwork;
authOrigin?: string;
appDetails: { appDetails: {
name: string; name: string;
icon: string; icon: string;
@ -254,7 +245,6 @@ interface ContractCallOptions {
| functionArgs | `ClarityValue[]` | true | Arguments for calling the function. [Learn more about constructing clarity values](https://github.com/blockstack/stacks.js/tree/master/packages/transactions#constructing-clarity-values). Defaults to `[]`. | | functionArgs | `ClarityValue[]` | true | Arguments for calling the function. [Learn more about constructing clarity values](https://github.com/blockstack/stacks.js/tree/master/packages/transactions#constructing-clarity-values). Defaults to `[]`. |
| appDetails | object | true | Dictionary that requires `name` and `icon` for app | | appDetails | object | true | Dictionary that requires `name` and `icon` for app |
| onFinish | function | true | Callback executed by app when transaction has been signed and broadcasted. [Read more](#onFinish-option) | | | onFinish | function | true | Callback executed by app when transaction has been signed and broadcasted. [Read more](#onFinish-option) | |
| authOrigin | string | false | URL of authenticator to use for prompting signature and broadcast. Defaults to `https://wallet.hiro.so` for the Stacks Wallet, which is handled by the Stacks Wallet browser extension if installed. |
| network | StacksNetwork | false | Specify the network that this transaction should be completed on. [Read more](#network-option) | | network | StacksNetwork | false | Specify the network that this transaction should be completed on. [Read more](#network-option) |
## Getting the signed transaction back after completion {#onFinish-option} ## Getting the signed transaction back after completion {#onFinish-option}

Loading…
Cancel
Save