Skip to content

Commit

Permalink
feat: Implement verbose output for transactions pipelines (#148)
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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <caio.xd63@hotmail.com>

---------

Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <caio.xd63@hotmail.com>

---------

Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* 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 <brunonascimentodev@gmail.com>
Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* 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 <brunonascimentodev@gmail.com>
Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* packaging: bump version to 0.8.1

* Minor fixes (#141)

* feat: standardize network config options as functions under network

* fix: duplicate imports

* fix: read from contract output

* chore: bump version

* chore: bump version to 0.8.2

* Contract engine improvements (#144)

* feat: standardize network config options as functions under network

* fix: duplicate imports

* version 0.8.2 (#142)

* 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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <caio.xd63@hotmail.com>

---------

Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <brunonascimentodev@gmail.com>

* 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 <caio.xd63@hotmail.com>

---------

Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* 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 <brunonascimentodev@gmail.com>
Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* 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 <brunonascimentodev@gmail.com>
Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* packaging: bump version to 0.8.1

* Minor fixes (#141)

* feat: standardize network config options as functions under network

* fix: duplicate imports

* fix: read from contract output

* chore: bump version

* chore: bump version to 0.8.2

---------

Co-authored-by: Bruno Nascimento <brunonascimentodev@gmail.com>
Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>

* Documentation (#143)

* GITBOOK-34: No subject

* GITBOOK-35: update issuing your first asset tutorial

* GITBOOK-36: update CD tutorial

* GITBOOK-37: update profiler plugin

* GITBOOK-38: Remove soroban token duplicate link

* GITBOOK-39: update soroban token handler

* GITBOOK-40: Improve Validation Cloud RPC page

* GITBOOK-41: Improve the Welcome Page

* GITBOOK-42: Improve Quick Start page

* GITBOOK-45: Soroban Auth Pipeline

* GITBOOK-47: update general doc

---------

Co-authored-by: Fernanda Hahn <stellar.asset.sandbox@gmail.com>

* feat: remove spec requirement to instantiate contract engine

* test: add unit test to spec requirement

* feat: export stellar-sdk contract spec

---------

Co-authored-by: Bruno Nascimento <brunonascimentodev@gmail.com>
Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>
Co-authored-by: Fernanda Hahn <stellar.asset.sandbox@gmail.com>

* chore: bump version to 0.8.3

* fix: soroban auth simulation fails if partial auth entries are present

* chore: bump version to 0.8.4

* feat: Implement verbose output for transactions pipelines (#147)

* feat: implement verbose output for classic pipeline

* feat: implement verbose output for soroban pipeline

* chore: bump version to 0.9.0

---------

Co-authored-by: Bruno Nascimento <brunonascimentodev@gmail.com>
Co-authored-by: Caio Teixeira <caio.xd63@hotmail.com>
Co-authored-by: Fernanda Hahn <stellar.asset.sandbox@gmail.com>
  • Loading branch information
4 people authored May 17, 2024
1 parent 09458fd commit 0ff35bb
Show file tree
Hide file tree
Showing 14 changed files with 274 additions and 133 deletions.
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.4",
"version": "0.9.0",
"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
17 changes: 10 additions & 7 deletions src/stellar-plus/asset/classic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {
} from 'stellar-plus/asset/classic/types'
import { AssetTypes } from 'stellar-plus/asset/types'
import { ClassicTransactionPipeline } from 'stellar-plus/core/pipelines/classic-transaction'
import { ClassicTransactionPipelineOptions } from 'stellar-plus/core/pipelines/classic-transaction/types'
import {
ClassicTransactionPipelineOptions,
ClassicTransactionPipelineOutputSimple,
} from 'stellar-plus/core/pipelines/classic-transaction/types'
import { TransactionInvocation } from 'stellar-plus/core/types'
import { HorizonHandlerClient as HorizonHandler } from 'stellar-plus/horizon'

Expand Down Expand Up @@ -231,10 +234,10 @@ export class ClassicAssetHandler implements IClassicAssetHandler {
source: this.asset.getIssuer(),
})

const result = await this.classicTransactionPipeline.execute({
const result = (await this.classicTransactionPipeline.execute({
txInvocation: updatedTxInvocation,
operations: [mintOp],
})
})) as ClassicTransactionPipelineOutputSimple

return result.response
}
Expand Down Expand Up @@ -290,10 +293,10 @@ export class ClassicAssetHandler implements IClassicAssetHandler {
source: this.asset.getIssuer(),
})

const result = await this.classicTransactionPipeline.execute({
const result = (await this.classicTransactionPipeline.execute({
txInvocation: updatedTxInvocation,
operations: [addTrustlineOp, mintOp],
})
})) as ClassicTransactionPipelineOutputSimple

return result.response
}
Expand Down Expand Up @@ -323,10 +326,10 @@ export class ClassicAssetHandler implements IClassicAssetHandler {
asset: this.asset,
})

const result = await this.classicTransactionPipeline.execute({
const result = (await this.classicTransactionPipeline.execute({
txInvocation,
operations: [addTrustlineOp],
})
})) as ClassicTransactionPipelineOutputSimple

return result.response
}
Expand Down
75 changes: 45 additions & 30 deletions src/stellar-plus/asset/soroban-token/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { spec as defaultSpec, methods } from 'stellar-plus/asset/soroban-token/c
import { SorobanTokenHandlerConstructorArgs, SorobanTokenInterface } from 'stellar-plus/asset/soroban-token/types'
import { AssetTypes } from 'stellar-plus/asset/types'
import { ContractEngine } from 'stellar-plus/core/contract-engine'
import { SorobanTransactionPipelineOutputSimple } from 'stellar-plus/core/pipelines/soroban-transaction/types'
import { SorobanSimulationInvocation, TransactionInvocation } from 'stellar-plus/core/types'
import { i128, u32 } from 'stellar-plus/types'

Expand Down Expand Up @@ -51,11 +52,11 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Initialize the contract instance with the given parameters.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*/
public async initialize(
args: { admin: string; decimal: u32; name: string; symbol: string } & TransactionInvocation
): Promise<void> {
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.initialize,
methodArgs: {
Expand All @@ -67,7 +68,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

//==========================================
Expand All @@ -86,11 +87,13 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Set a new admin account for the contract.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*
* @requires {args.id} to be the current admin account
*/
public async setAdmin(args: { id: string; new_admin: string } & TransactionInvocation): Promise<void> {
public async setAdmin(
args: { id: string; new_admin: string } & TransactionInvocation
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.set_admin,
methodArgs: {
Expand All @@ -100,7 +103,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand Down Expand Up @@ -133,11 +136,13 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Authorize or deauthorize an account to interact with the contract.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*
* @requires - Authorization from the admin account
*/
public async setAuthorized(args: { id: string; authorize: boolean } & TransactionInvocation): Promise<void> {
public async setAuthorized(
args: { id: string; authorize: boolean } & TransactionInvocation
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.set_authorized,
methodArgs: {
Expand All @@ -147,7 +152,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand All @@ -162,11 +167,13 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Mint tokens to an account.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*
* @requires - Authorization from the admin account
*/
public async mint(args: { to: string; amount: i128 } & TransactionInvocation): Promise<void> {
public async mint(
args: { to: string; amount: i128 } & TransactionInvocation
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.mint,
methodArgs: {
Expand All @@ -176,7 +183,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand All @@ -191,11 +198,13 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Clawback tokens from an account.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*
* @requires - Authorization from the admin account
*/
public async clawback(args: { from: string; amount: i128 } & TransactionInvocation): Promise<void> {
public async clawback(
args: { from: string; amount: i128 } & TransactionInvocation
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.clawback,
methodArgs: {
Expand All @@ -205,7 +214,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

//==========================================
Expand Down Expand Up @@ -253,11 +262,11 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Approve a spender to spend tokens on behalf of the account.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*/
public async approve(
args: { from: string; spender: string; amount: i128; expiration_ledger: u32 } & TransactionInvocation
): Promise<void> {
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.approve,
methodArgs: {
Expand All @@ -269,7 +278,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand Down Expand Up @@ -327,9 +336,11 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Transfer tokens from the sender to the recipient.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*/
public async transfer(args: { from: string; to: string; amount: i128 } & TransactionInvocation): Promise<void> {
public async transfer(
args: { from: string; to: string; amount: i128 } & TransactionInvocation
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.transfer,
methodArgs: {
Expand All @@ -340,7 +351,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand All @@ -357,11 +368,11 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Transfer tokens from the sender to the recipient on behalf of the spender.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*/
public async transferFrom(
args: { spender: string; from: string; to: string; amount: i128 } & TransactionInvocation
): Promise<void> {
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.transfer_from,
methodArgs: {
Expand All @@ -373,7 +384,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand All @@ -388,9 +399,11 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Burn tokens from an account.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*/
public async burn(args: { from: string; amount: i128 } & TransactionInvocation): Promise<void> {
public async burn(
args: { from: string; amount: i128 } & TransactionInvocation
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.burn,
methodArgs: {
Expand All @@ -400,7 +413,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand All @@ -416,9 +429,11 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
*
* @description Burn tokens from an account on behalf of the spender.
*
* @returns {Promise<void>}
* @returns {Promise<SorobanTransactionPipelineOutputSimple>}
*/
public async burnFrom(args: { spender: string; from: string; amount: i128 } & TransactionInvocation): Promise<void> {
public async burnFrom(
args: { spender: string; from: string; amount: i128 } & TransactionInvocation
): Promise<SorobanTransactionPipelineOutputSimple> {
return (await this.invokeContract({
method: methods.burn_from,
methodArgs: {
Expand All @@ -429,7 +444,7 @@ export class SorobanTokenHandler extends ContractEngine implements SorobanTokenI
signers: args.signers,
header: args.header,
feeBump: args.feeBump,
})) as void
})) as SorobanTransactionPipelineOutputSimple
}

/**
Expand Down
27 changes: 17 additions & 10 deletions src/stellar-plus/asset/soroban-token/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ContractSpec } from '@stellar/stellar-sdk'

import { AssetType } from 'stellar-plus/asset/types'
import { Options } from 'stellar-plus/core/contract-engine/types'
import { SorobanTransactionPipelineOutputSimple } from 'stellar-plus/core/pipelines/soroban-transaction/types'
import { SorobanSimulationInvocation, TransactionInvocation } from 'stellar-plus/core/types'
import { NetworkConfig, i128, u32 } from 'stellar-plus/types'

Expand All @@ -21,13 +22,13 @@ export type SorobanTokenInterface = AssetType & SorobanTokenInterfaceManagement
export type SorobanTokenInterfaceManagement = {
initialize: (
args: { admin: string; decimal: u32; name: string; symbol: string } & TransactionInvocation
) => Promise<void>
) => Promise<SorobanTransactionPipelineOutputSimple>
setAdmin: (
args: {
id: string
new_admin: string
} & TransactionInvocation
) => Promise<void>
) => Promise<SorobanTransactionPipelineOutputSimple>

admin: (args: TransactionInvocation) => Promise<string>

Expand All @@ -36,36 +37,42 @@ export type SorobanTokenInterfaceManagement = {
id: string
authorize: boolean
} & TransactionInvocation
) => Promise<void>
) => Promise<SorobanTransactionPipelineOutputSimple>

mint: (
args: {
to: string
amount: i128
} & TransactionInvocation
) => Promise<void>
) => Promise<SorobanTransactionPipelineOutputSimple>

clawback: (
args: {
from: string
amount: i128
} & TransactionInvocation
) => Promise<void>
) => Promise<SorobanTransactionPipelineOutputSimple>
}

export type SorobanTokenInterfaceUser = {
allowance: (args: { from: string; spender: string } & SorobanSimulationInvocation) => Promise<i128>
approve: (
args: { from: string; spender: string; amount: i128; expiration_ledger: u32 } & TransactionInvocation
) => Promise<void>
) => Promise<SorobanTransactionPipelineOutputSimple>
balance: (args: { id: string } & SorobanSimulationInvocation) => Promise<i128>
spendableBalance: (args: { id: string } & SorobanSimulationInvocation) => Promise<i128>
transfer: (args: { from: string; to: string; amount: i128 } & TransactionInvocation) => Promise<void>
transfer: (
args: { from: string; to: string; amount: i128 } & TransactionInvocation
) => Promise<SorobanTransactionPipelineOutputSimple>
transferFrom: (
args: { spender: string; from: string; to: string; amount: i128 } & TransactionInvocation
) => Promise<void>
burn: (args: { from: string; amount: i128 } & TransactionInvocation) => Promise<void>
burnFrom: (args: { spender: string; from: string; amount: i128 } & TransactionInvocation) => Promise<void>
) => Promise<SorobanTransactionPipelineOutputSimple>
burn: (
args: { from: string; amount: i128 } & TransactionInvocation
) => Promise<SorobanTransactionPipelineOutputSimple>
burnFrom: (
args: { spender: string; from: string; amount: i128 } & TransactionInvocation
) => Promise<SorobanTransactionPipelineOutputSimple>
decimals: (args: SorobanSimulationInvocation) => Promise<u32>
name: (args: SorobanSimulationInvocation) => Promise<string>
symbol: (args: SorobanSimulationInvocation) => Promise<string>
Expand Down
Loading

0 comments on commit 0ff35bb

Please sign in to comment.