@@ -2976,8 +2976,6 @@ const result = await sdk.voting.masternodeVote({ masternodeProTxHash, votePoll,
29762976** Address Transfer** - ` addresses.transfer `
29772977* Transfer credits between Platform addresses*
29782978
2979- ** Disabled:** Platform addresses not fully implemented in SDK
2980-
29812979Signature: ` transfer(options: wasm.AddressFundsTransferOptions): Promise<Map<string, wasm.PlatformAddressInfo>> `
29822980
29832981Parameters:
@@ -3012,19 +3010,19 @@ Returns:
30123010
30133011Example:
30143012``` javascript
3015- import { PlatformAddressInput , PlatformAddressOutput , PlatformAddressSigner } from ' @dashevo/evo-sdk' ;
3016- const inputs = [new PlatformAddressInput ({ address: senderAddress, amount })];
3017- const outputs = [new PlatformAddressOutput ({ address: recipientAddress, amount })];
3013+ import { PlatformAddressSigner , PrivateKey } from ' @dashevo/evo-sdk' ;
30183014const signer = new PlatformAddressSigner ();
3019- signer .addKey (privateKey);
3020- await sdk .addresses .transfer ({ inputs, outputs, signer });
3015+ const senderAddress = signer .addKey (PrivateKey .fromWIF (addressPrivateKeyWif));
3016+ const addressInfo = await sdk .addresses .get (senderAddress);
3017+ if (! addressInfo) throw new Error (' Platform Address is not funded' );
3018+ const input = { address: senderAddress .toBech32m (network), amount: BigInt (amount) };
3019+ const output = { address: recipientAddress, amount: BigInt (amount) };
3020+ await sdk .addresses .transfer ({ inputs: [input], outputs: [output], signer });
30213021```
30223022
30233023** Top Up Identity from Address** - ` addresses.topUpIdentity `
30243024* Top up an identity using Platform address credits*
30253025
3026- ** Disabled:** Platform addresses not fully implemented in SDK
3027-
30283026Signature: ` topUpIdentity(options: wasm.IdentityTopUpFromAddressesOptions): Promise<wasm.IdentityTopUpFromAddressesResult> `
30293027
30303028Parameters:
@@ -3054,19 +3052,20 @@ Returns:
30543052
30553053Example:
30563054``` javascript
3057- import { PlatformAddressInput , PlatformAddressSigner } from ' @dashevo/evo-sdk' ;
30583055const identity = await sdk .identities .fetch (identityId);
3059- const inputs = [new PlatformAddressInput ({ address: senderAddress, amount })];
3056+ if (! identity) throw new Error (' Identity not found' );
3057+ import { PlatformAddressSigner , PrivateKey } from ' @dashevo/evo-sdk' ;
30603058const signer = new PlatformAddressSigner ();
3061- signer .addKey (privateKey);
3062- await sdk .addresses .topUpIdentity ({ identity, inputs, signer });
3059+ const senderAddress = signer .addKey (PrivateKey .fromWIF (addressPrivateKeyWif));
3060+ const addressInfo = await sdk .addresses .get (senderAddress);
3061+ if (! addressInfo) throw new Error (' Platform Address is not funded' );
3062+ const input = { address: senderAddress .toBech32m (network), amount: BigInt (amount) };
3063+ await sdk .addresses .topUpIdentity ({ identity, inputs: [input], signer });
30633064```
30643065
30653066** Withdraw to Core** - ` addresses.withdraw `
30663067* Withdraw Platform address credits to Dash Core*
30673068
3068- ** Disabled:** Platform addresses not fully implemented in SDK
3069-
30703069Signature: ` withdraw(options: wasm.AddressFundsWithdrawOptions): Promise<Map<string, wasm.PlatformAddressInfo>> `
30713070
30723071Parameters:
@@ -3114,19 +3113,19 @@ Returns:
31143113
31153114Example:
31163115``` javascript
3117- import { CoreScript , PlatformAddressInput , PlatformAddressSigner } from ' @dashevo/evo-sdk' ;
3118- const inputs = [new PlatformAddressInput ({ address: senderAddress, amount })];
3119- const outputScript = CoreScript .newP2PKH (coreAddress);
3116+ import { PlatformAddressSigner , PrivateKey } from ' @dashevo/evo-sdk' ;
31203117const signer = new PlatformAddressSigner ();
3121- signer .addKey (privateKey);
3122- await sdk .addresses .withdraw ({ inputs, coreFeePerByte, pooling, outputScript, signer });
3118+ const senderAddress = signer .addKey (PrivateKey .fromWIF (addressPrivateKeyWif));
3119+ const addressInfo = await sdk .addresses .get (senderAddress);
3120+ if (! addressInfo) throw new Error (' Platform Address is not funded' );
3121+ const input = { address: senderAddress .toBech32m (network), amount: BigInt (amount) };
3122+ const outputScript = CoreScript .fromP2PKH (coreAddressHash);
3123+ await sdk .addresses .withdraw ({ inputs: [input], coreFeePerByte, pooling: PoolingWasm .Never , outputScript, signer });
31233124```
31243125
31253126** Transfer from Identity to Address** - ` addresses.transferFromIdentity `
31263127* Transfer credits from an identity to Platform addresses*
31273128
3128- ** Disabled:** Platform addresses not fully implemented in SDK
3129-
31303129Signature: ` transferFromIdentity(options: wasm.IdentityTransferToAddressesOptions): Promise<wasm.IdentityTransferToAddressesResult> `
31313130
31323131Parameters:
@@ -3159,9 +3158,10 @@ Returns:
31593158
31603159Example:
31613160``` javascript
3162- import { IdentitySigner , PlatformAddressOutput } from ' @dashevo/evo-sdk' ;
3161+ import { IdentitySigner } from ' @dashevo/evo-sdk' ;
31633162const identity = await sdk .identities .fetch (identityId);
3164- const outputs = [new PlatformAddressOutput ({ address: recipientAddress, amount })];
3163+ if (! identity) throw new Error (' Identity not found' );
3164+ const outputs = [{ address: recipientAddress, amount: BigInt (amount) }];
31653165const signer = new IdentitySigner ();
31663166signer .addKeyFromWif (privateKeyWif);
31673167await sdk .addresses .transferFromIdentity ({ identity, outputs, signer });
@@ -3170,8 +3170,6 @@ await sdk.addresses.transferFromIdentity({ identity, outputs, signer });
31703170** Fund Address from Asset Lock** - ` addresses.fundFromAssetLock `
31713171* Fund Platform addresses from an asset lock*
31723172
3173- ** Disabled:** Platform addresses not fully implemented in SDK
3174-
31753173Signature: ` fundFromAssetLock(options: wasm.AddressFundingFromAssetLockOptions): Promise<Map<string, wasm.PlatformAddressInfo>> `
31763174
31773175Parameters:
@@ -3210,19 +3208,18 @@ Returns:
32103208
32113209Example:
32123210``` javascript
3213- import { AssetLockProof , PlatformAddressOutput , PlatformAddressSigner , PrivateKey } from ' @dashevo/evo-sdk' ;
3211+ import { AssetLockProof , PlatformAddressSigner , PrivateKey } from ' @dashevo/evo-sdk' ;
32143212const assetLockProof = AssetLockProof .fromHex (assetLockProofHex);
32153213const assetLockPrivateKey = PrivateKey .fromWIF (assetLockPrivateKeyWif);
3216- const outputs = [new PlatformAddressOutput ({ address: recipientAddress, amount })];
32173214const signer = new PlatformAddressSigner ();
3215+ signer .addKey (PrivateKey .fromWIF (addressPrivateKeyWif));
3216+ const outputs = [{ address: recipientAddress, amount: BigInt (amount) }];
32183217await sdk .addresses .fundFromAssetLock ({ assetLockProof, assetLockPrivateKey, outputs, signer });
32193218```
32203219
32213220** Create Identity from Address** - ` addresses.createIdentity `
32223221* Create a new identity funded from Platform addresses*
32233222
3224- ** Disabled:** Platform addresses not fully implemented in SDK
3225-
32263223Signature: ` createIdentity(options: wasm.IdentityCreateFromAddressesOptions): Promise<wasm.IdentityCreateFromAddressesResult> `
32273224
32283225Parameters:
@@ -3261,16 +3258,16 @@ Returns:
32613258
32623259Example:
32633260``` javascript
3264- import { Identifier , Identity , IdentityPublicKeyInCreation , IdentitySigner , KeyType , PlatformAddressInput , PlatformAddressSigner , PrivateKey , Purpose , SecurityLevel } from ' @dashevo/evo-sdk' ;
3261+ import { Identifier , Identity , IdentityPublicKeyInCreation , IdentitySigner , KeyType , PlatformAddressSigner , PrivateKey , Purpose , SecurityLevel } from ' @dashevo/evo-sdk' ;
32653262const identityPrivateKey = PrivateKey .fromWIF (identityPrivateKeyWif);
3266- const identity = new Identity (Identifier .random ( ));
3263+ const identity = new Identity (Identifier .fromBytes ( crypto . getRandomValues ( new Uint8Array ( 32 )) ));
32673264const identityPublicKey = new IdentityPublicKeyInCreation ({ keyId: 0 , purpose: Purpose .AUTHENTICATION , securityLevel: SecurityLevel .MASTER , keyType: KeyType .ECDSA_SECP256K1 , data: identityPrivateKey .getPublicKey ().toBytes () }).toIdentityPublicKey ();
32683265identity .addPublicKey (identityPublicKey);
3269- const inputs = [new PlatformAddressInput ({ address: senderAddress, amount })];
3266+ const addressSigner = new PlatformAddressSigner ();
3267+ const derivedAddress = addressSigner .addKey (PrivateKey .fromWIF (addressPrivateKeyWif));
3268+ const inputs = [{ address: derivedAddress .toBech32m (network), amount: BigInt (amount) }];
32703269const identitySigner = new IdentitySigner ();
32713270identitySigner .addKey (identityPrivateKey);
3272- const addressSigner = new PlatformAddressSigner ();
3273- addressSigner .addKey (addressPrivateKey);
32743271await sdk .addresses .createIdentity ({ identity, inputs, identitySigner, addressSigner });
32753272```
32763273
0 commit comments