Skip to content

Commit

Permalink
Update Stellar SDK (#140)
Browse files Browse the repository at this point in the history
* chore: add jest setup to coverage all files (#101)

* refactor: fix circular import

* test: contract engine initial structure

* Contract Engine unit tests (#103)

* refactor: contract engine errors

* feat: validate required initialization arguments

* test: contract engine initialization workflow

* test: complete contract engine main coverage

* refactor: update deprecated methods

* refactor: contract engine errors (#104)

* Update docs and minor adjustments to jsdocs (#105)

* fix: missing error CE009

* docs: update jsdoc

* docs: update readme for public release

* packaging: bump version to 0.7.0 (#108)

* test: add build transaction unit tests

* chore: merge with develop

* test: add build transaction failure tests

* refactor: make networkConfig variable private

* test: add unit test for fee bump pipeline (#113)

* test: add unit tests for classic signature requirements pipeline (#115)

* Adjustments to release library as open source 🚀  (#107)

* chore: add jest setup to coverage all files (#101)

* refactor: fix circular import

* test: contract engine initial structure

* Contract Engine unit tests (#103)

* refactor: contract engine errors

* feat: validate required initialization arguments

* test: contract engine initialization workflow

* test: complete contract engine main coverage

* refactor: update deprecated methods

* refactor: contract engine errors (#104)

* Update docs and minor adjustments to jsdocs (#105)

* fix: missing error CE009

* docs: update jsdoc

* docs: update readme for public release

* packaging: bump version to 0.7.0 (#108)

---------

Co-authored-by: Bruno Nascimento <[email protected]>

* fix: setoptions op threshold requirement

* fix: revoke operation variants threshold calculation

* test: add unit tests to classig sign requirements pipeline

* refactor: rearrange as per aaa pattern

---------

Co-authored-by: Bruno Nascimento <[email protected]>

* Add unit tests for simulate transaction pipeline (#117)

* refactor: eslint adjustments

* test: initial simulate transaction unit tests

* feat: add assemble transaction sp error

* test: complete coverage for simulate transaction pipeline

* refactor: clean up comments and adjust imports

* Add unit tests for classic transaction pipeline (#118)

* test: add unit tests for classic transaction pipeline

* refactor: adjust imports

* test: add unit tests for soroban transaction pipeline (#119)

* test: add unit test for sign transaction pipeline

* test: add unit test for submit transaction pipeline

* Add unit tests soroban auth (#123)

* fix: remove validation from contract engine initialization

* style: remove comment

* feat: modify account handler mocker payload

* test: add unit test to soroban auth pipeline

---------

Co-authored-by: Bruno Nascimento <[email protected]>

* Complete unit test coverage for account handlers (#125)

* test: add unit tests for the default account handler

* test: validate error to sign auth entry

* feat: add fee bump type to sign payload

* test: refactor freighter account handler unit tests

* Create test-coverage.yml action (#126)

* Create test-coverage.yml action

* Update test-coverage.yml

* Add unit test for base account handler (#127)

* test: add unit tests for the default account handler

* test: validate error to sign auth entry

* feat: add fee bump type to sign payload

* test: refactor freighter account handler unit tests

* test: add unit tests for base account handler

* Add unit test for soroban get transaction pipeline (#124)

* refactor: soroban get transaction pipeline constructor

* fix: remove old log

* test: add unit tests for soroban get transaction pipeline

* style: adjust imports

* Add unit tests for the classic asset handler (#128)

* refactor: adjust outter imports/exports

* test: add unit tests for the classic asset handler

* feat: remove issuer requirement for classic assets (#129)

* refactor: allow for no payload for dah

* feat: remove issuer necessity for classic assets to better include native

* test: add unit test to soroban token handler (#131)

* feat: remove helper classes for account (#132)

* feat: remove helper classes for account

* refactor: remove unused error for base account

* test: complete unit coverage for base account errors

* Standardize default network configs and custom (#133)

* feat: standardize network config options as functions under network

* test: adjust tests for new network config format

* feat: require rpc url for default rpc handler to initialize

* feat: require horizon url to initialize default horizon handler

* test: remove local testing from coverage

* feat: remove soroban client

* feat: convert horizon load account error to sp error

* feat: add allowhttp to network config

* test: add unit tests to default horizon handler

* test: add default rpc handler unit tests

* fix: account changes with network new config format

* test: add network configuration unit tests

* refactor: allowhttp object

Co-authored-by: Caio Teixeira <[email protected]>

---------

Co-authored-by: Caio Teixeira <[email protected]>

* packaging: bump version to v0.8.0

* Fix merge issues (#137)

* feat: standardize network config options as functions under network

* fix: duplicate imports

* Update stellar sdk (#139)

* Release v0.8.0 (#136)

* chore: add jest setup to coverage all files (#101)

* refactor: fix circular import

* test: contract engine initial structure

* Contract Engine unit tests (#103)

* refactor: contract engine errors

* feat: validate required initialization arguments

* test: contract engine initialization workflow

* test: complete contract engine main coverage

* refactor: update deprecated methods

* refactor: contract engine errors (#104)

* Update docs and minor adjustments to jsdocs (#105)

* fix: missing error CE009

* docs: update jsdoc

* docs: update readme for public release

* packaging: bump version to 0.7.0 (#108)

* test: add build transaction unit tests

* chore: merge with develop

* test: add build transaction failure tests

* refactor: make networkConfig variable private

* test: add unit test for fee bump pipeline (#113)

* test: add unit tests for classic signature requirements pipeline (#115)

* Adjustments to release library as open source 🚀  (#107)

* chore: add jest setup to coverage all files (#101)

* refactor: fix circular import

* test: contract engine initial structure

* Contract Engine unit tests (#103)

* refactor: contract engine errors

* feat: validate required initialization arguments

* test: contract engine initialization workflow

* test: complete contract engine main coverage

* refactor: update deprecated methods

* refactor: contract engine errors (#104)

* Update docs and minor adjustments to jsdocs (#105)

* fix: missing error CE009

* docs: update jsdoc

* docs: update readme for public release

* packaging: bump version to 0.7.0 (#108)

---------

Co-authored-by: Bruno Nascimento <[email protected]>

* fix: setoptions op threshold requirement

* fix: revoke operation variants threshold calculation

* test: add unit tests to classig sign requirements pipeline

* refactor: rearrange as per aaa pattern

---------

Co-authored-by: Bruno Nascimento <[email protected]>

* Add unit tests for simulate transaction pipeline (#117)

* refactor: eslint adjustments

* test: initial simulate transaction unit tests

* feat: add assemble transaction sp error

* test: complete coverage for simulate transaction pipeline

* refactor: clean up comments and adjust imports

* Add unit tests for classic transaction pipeline (#118)

* test: add unit tests for classic transaction pipeline

* refactor: adjust imports

* test: add unit tests for soroban transaction pipeline (#119)

* test: add unit test for sign transaction pipeline

* test: add unit test for submit transaction pipeline

* Add unit tests soroban auth (#123)

* fix: remove validation from contract engine initialization

* style: remove comment

* feat: modify account handler mocker payload

* test: add unit test to soroban auth pipeline

---------

Co-authored-by: Bruno Nascimento <[email protected]>

* Complete unit test coverage for account handlers (#125)

* test: add unit tests for the default account handler

* test: validate error to sign auth entry

* feat: add fee bump type to sign payload

* test: refactor freighter account handler unit tests

* Create test-coverage.yml action (#126)

* Create test-coverage.yml action

* Update test-coverage.yml

* Add unit test for base account handler (#127)

* test: add unit tests for the default account handler

* test: validate error to sign auth entry

* feat: add fee bump type to sign payload

* test: refactor freighter account handler unit tests

* test: add unit tests for base account handler

* Add unit test for soroban get transaction pipeline (#124)

* refactor: soroban get transaction pipeline constructor

* fix: remove old log

* test: add unit tests for soroban get transaction pipeline

* style: adjust imports

* Add unit tests for the classic asset handler (#128)

* refactor: adjust outter imports/exports

* test: add unit tests for the classic asset handler

* feat: remove issuer requirement for classic assets (#129)

* refactor: allow for no payload for dah

* feat: remove issuer necessity for classic assets to better include native

* test: add unit test to soroban token handler (#131)

* feat: remove helper classes for account (#132)

* feat: remove helper classes for account

* refactor: remove unused error for base account

* test: complete unit coverage for base account errors

* Standardize default network configs and custom (#133)

* feat: standardize network config options as functions under network

* test: adjust tests for new network config format

* feat: require rpc url for default rpc handler to initialize

* feat: require horizon url to initialize default horizon handler

* test: remove local testing from coverage

* feat: remove soroban client

* feat: convert horizon load account error to sp error

* feat: add allowhttp to network config

* test: add unit tests to default horizon handler

* test: add default rpc handler unit tests

* fix: account changes with network new config format

* test: add network configuration unit tests

* refactor: allowhttp object

Co-authored-by: Caio Teixeira <[email protected]>

---------

Co-authored-by: Caio Teixeira <[email protected]>

* packaging: bump version to v0.8.0

* Fix merge issues (#137)

* feat: standardize network config options as functions under network

* fix: duplicate imports

---------

Co-authored-by: Bruno Nascimento <[email protected]>
Co-authored-by: Caio Teixeira <[email protected]>

* chore: update stellar sdk

* feat: add function to return secret key to default account handler

* test: default account handler getters

---------

Co-authored-by: Bruno Nascimento <[email protected]>
Co-authored-by: Caio Teixeira <[email protected]>

* packaging: bump version to 0.8.1

---------

Co-authored-by: Bruno Nascimento <[email protected]>
Co-authored-by: Caio Teixeira <[email protected]>
  • Loading branch information
3 people authored Apr 30, 2024
1 parent b7a18c3 commit bf5ac05
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 52 deletions.
100 changes: 49 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stellar-plus",
"version": "0.8.0",
"version": "0.8.1",
"description": "beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
15 changes: 15 additions & 0 deletions src/stellar-plus/account/account-handler/default/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { DefaultAccountHandler, DefaultAccountHandlerPayload } from 'stellar-plu
import { AccountBase } from 'stellar-plus/account/base'
import { TransactionXdr } from 'stellar-plus/types'

/**
* @class DefaultAccountHandlerClient
* @extends AccountBase
* @implements DefaultAccountHandler
* @description - The default account handler is used for handling and creating new accounts by directly manipulating the secret key. Avoid using this handler in production environments.
*/
export class DefaultAccountHandlerClient extends AccountBase implements DefaultAccountHandler {
protected secretKey: string

Expand Down Expand Up @@ -41,6 +47,15 @@ export class DefaultAccountHandlerClient extends AccountBase implements DefaultA
}
}

/**
* @description - Returns the secret key of the account.
*
* @returns {string} The secret key of the account.
*/
public getSecretKey(): string {
return this.secretKey
}

/**
*
* @param {Transaction} tx - The transaction to sign.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ describe('DefaultAccountHandler', () => {

expect(dah.getPublicKey()).toBe(Keypair.fromSecret(secretKey).publicKey())
})
})

describe('Core features', () => {

it('should sign a transaction with its secret key', () => {
const keypair = Keypair.random()
Expand Down Expand Up @@ -102,6 +105,22 @@ describe('DefaultAccountHandler', () => {
})
})

describe('Getters', () => {
it('should return the public key of the account', () => {
const keypair = Keypair.random()
const dah = new DefaultAccountHandlerClient({ networkConfig: TESTNET_CONFIG, secretKey: keypair.secret() })

expect(dah.getPublicKey()).toBe(keypair.publicKey())
})

it('should return the secret key of the account', () => {
const keypair = Keypair.random()
const dah = new DefaultAccountHandlerClient({ networkConfig: TESTNET_CONFIG, secretKey: keypair.secret() })

expect(dah.getSecretKey()).toBe(keypair.secret())
})
})

describe('Error Handling', () => {
beforeEach(() => {
jest.clearAllMocks()
Expand Down
1 change: 1 addition & 0 deletions src/stellar-plus/account/account-handler/default/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TransactionXdr } from 'stellar-plus/types'

export type DefaultAccountHandler = AccountHandler & {
sign(tx: Transaction): TransactionXdr
getSecretKey(): string
}

//
Expand Down

0 comments on commit bf5ac05

Please sign in to comment.