File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change 1- import { addTxSignatures , pvm , utils } from '../../../src' ;
1+ import { pvm , utils } from '../../../src' ;
22import { setupEtnaExample } from './utils/etna-helper' ;
33import { testGenesisData } from '../../../src/fixtures/transactions' ;
44import { getEnvVars } from '../../utils/getEnvVars' ;
5+ import { addSigToAllCreds } from './utils/addSignatureToAllCred' ;
56
67/**
78 * Create a new chain on the P-Chain.
@@ -38,10 +39,7 @@ const createChainTxExample = async () => {
3839 context ,
3940 ) ;
4041
41- await addTxSignatures ( {
42- unsignedTx : tx ,
43- privateKeys : [ utils . hexToBuffer ( PRIVATE_KEY ) ] ,
44- } ) ;
42+ await addSigToAllCreds ( tx , utils . hexToBuffer ( PRIVATE_KEY ) ) ;
4543
4644 return pvmApi . issueSignedTx ( tx . getSignedTx ( ) ) ;
4745} ;
Original file line number Diff line number Diff line change @@ -173,14 +173,10 @@ export class UnsignedTx {
173173
174174 private addSignatureForPubKey ( sig : Uint8Array , publicKey : Uint8Array ) {
175175 const coordinates = this . getSigIndicesForPubKey ( publicKey ) ;
176- for ( let i = 0 ; i < this . getCredentials ( ) . length ; i ++ ) {
177- if ( coordinates [ i ] ) {
178- coordinates . forEach ( ( [ index , subIndex ] ) => {
179- this . addSignatureAt ( sig , index , subIndex ) ;
180- } ) ;
181- } else {
182- this . addSignatureAt ( sig , i , 0 ) ;
183- }
176+ if ( coordinates ) {
177+ coordinates . forEach ( ( [ index , subIndex ] ) => {
178+ this . addSignatureAt ( sig , index , subIndex ) ;
179+ } ) ;
184180 }
185181 }
186182
You can’t perform that action at this time.
0 commit comments