File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ DATA_CONTRACT_ID=''
1111# RECIPIENT_ID is an identity ID for credit transfer tutorials
1212RECIPIENT_ID = ' '
1313
14+ # RECIPIENT_PLATFORM_ADDRESS is a bech32m platform address (tdash1...) for send-funds tutorial
15+ RECIPIENT_PLATFORM_ADDRESS = ' '
16+
1417# WITHDRAWAL_ADDRESS is a Core chain address for credit withdrawal tutorials
1518WITHDRAWAL_ADDRESS = ' '
1619
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // See https://docs.dash.org/projects/platform/en/stable/docs/tutorials/send-funds.html
2+ import { setupDashClient } from './setupDashClient.mjs' ;
3+
4+ const { sdk, addressKeyManager } = await setupDashClient ( ) ;
5+ const signer = addressKeyManager . getSigner ( ) ;
6+
7+ const recipient =
8+ process . env . RECIPIENT_PLATFORM_ADDRESS ||
9+ 'tdash1kr2ygqnqvsms509f78t4v3uqmce2re22jqycaxh4' ;
10+ const amount = 500000n ; // 0.000005 DASH
11+
12+ try {
13+ const result = await sdk . addresses . transfer ( {
14+ inputs : [
15+ {
16+ address : addressKeyManager . primaryAddress . bech32m ,
17+ amount,
18+ } ,
19+ ] ,
20+ outputs : [
21+ {
22+ address : recipient ,
23+ amount,
24+ } ,
25+ ] ,
26+ signer,
27+ } ) ;
28+ console . log ( `Transaction broadcast! Sent ${ amount } credits to ${ recipient } ` ) ;
29+ for ( const [ address , info ] of result ) {
30+ const addr =
31+ typeof address === 'string' ? address : address . toBech32m ( 'testnet' ) ;
32+ console . log ( ` ${ addr } : ${ info . balance } credits (nonce: ${ info . nonce } )` ) ;
33+ }
34+ } catch ( e ) {
35+ console . error ( 'Something went wrong:\n' , e . message ) ;
36+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,19 @@ import {
1111const state = { } ;
1212
1313describe ( 'Write tutorials (sequential)' , { concurrency : 1 } , ( ) => {
14+ // -----------------------------------------------------------------------
15+ // Phase 0: Address transfers (no identity needed)
16+ // -----------------------------------------------------------------------
17+
18+ it ( 'send-funds' , { timeout : 120_000 } , async ( ) => {
19+ const result = await runTutorial ( 'send-funds.mjs' , { timeoutMs : 120_000 } ) ;
20+ assertTutorialSuccess ( result , {
21+ name : 'send-funds' ,
22+ expectedPatterns : [ 'Transaction broadcast!' ] ,
23+ errorPatterns : [ 'Something went wrong' ] ,
24+ } ) ;
25+ } ) ;
26+
1427 // -----------------------------------------------------------------------
1528 // Phase 1: Identity
1629 // -----------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments