@depay/web3-wallets-evm 15.4.6 → 15.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/esm/index.evm.js +33073 -51288
- package/dist/esm/index.js +20 -16
- package/dist/esm/index.solana.js +25 -58931
- package/dist/umd/index.evm.js +34031 -52246
- package/dist/umd/index.js +19 -15
- package/dist/umd/index.solana.js +33 -58940
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -351,6 +351,44 @@ let sentTransaction = await wallet.sendTransaction({
|
|
|
351
351
|
})
|
|
352
352
|
```
|
|
353
353
|
|
|
354
|
+
###### Solana: Instruction signers
|
|
355
|
+
|
|
356
|
+
If you need to sign an instruction (e.g. creating "throw away" accounts)
|
|
357
|
+
|
|
358
|
+
you can set the `signers` of an instruction, which will be used to partially sign the transaction:
|
|
359
|
+
|
|
360
|
+
```javascript
|
|
361
|
+
import { getProvider } from '@depay/web3-client'
|
|
362
|
+
import { Token } from '@depay/web3-tokens'
|
|
363
|
+
import { PublicKey, SystemProgram, Keypair } from '@depay/solana-web3.js'
|
|
364
|
+
|
|
365
|
+
const wallets = await getWallets()
|
|
366
|
+
const wallet = wallets[0]
|
|
367
|
+
const fromAddress = await wallet.account()
|
|
368
|
+
const provider = await getProvider('solana')
|
|
369
|
+
const keypair = Keypair.generate()
|
|
370
|
+
const account = keypair.publicKey.toString()
|
|
371
|
+
const rent = await provider.getMinimumBalanceForRentExemption(Token.solana.TOKEN_LAYOUT.span)
|
|
372
|
+
|
|
373
|
+
let instruction = SystemProgram.createAccount({
|
|
374
|
+
fromPubkey: new SolanaWeb3js.PublicKey(fromAddress),
|
|
375
|
+
newAccountPubkey: new SolanaWeb3js.PublicKey(wrappedAccount),
|
|
376
|
+
programId: new SolanaWeb3js.PublicKey(Web3Tokens.Token.solana.TOKEN_PROGRAM),
|
|
377
|
+
space: Web3Tokens.Token.solana.TOKEN_LAYOUT.span,
|
|
378
|
+
lamports: rent
|
|
379
|
+
})
|
|
380
|
+
|
|
381
|
+
instruction.signers = [keypair]
|
|
382
|
+
|
|
383
|
+
let sentTransaction = await wallet.sendTransaction({
|
|
384
|
+
blockchain: 'solana',
|
|
385
|
+
instructions: [instruction],
|
|
386
|
+
sent: function(transaction){},
|
|
387
|
+
succeeded: function(transaction){},
|
|
388
|
+
failed: function(transaction, error){}
|
|
389
|
+
})
|
|
390
|
+
```
|
|
391
|
+
|
|
354
392
|
#### value
|
|
355
393
|
|
|
356
394
|
If value is passed as a number it's gonna be converted into a big number applying the individual blockchain's default decimals:
|