Skip to content

Commit

Permalink
fix(api): remove balances.transfer method (#1538)
Browse files Browse the repository at this point in the history
  • Loading branch information
osipov-mit authored Apr 26, 2024
1 parent 89abc39 commit 1e688c0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
9 changes: 9 additions & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.38.0

_04/26/2024_

### Changes
https://github.com/gear-tech/gear-js/pull/1538
- Remove `balances.transfer` method
- `api.balance.transfer` method now accepts one more argument `keepAlive` that is set to `true` by default

## 0.37.2

_04/11/2024_
Expand Down
4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gear-js/api",
"version": "0.37.2",
"version": "0.38.0",
"description": "A JavaScript library that provides functionality to connect GEAR Component APIs.",
"main": "cjs/index.js",
"module": "index.js",
Expand Down Expand Up @@ -48,7 +48,7 @@
},
"license": "GPL-3.0",
"peerDependencies": {
"@polkadot/api": "10.12.3",
"@polkadot/api": "11.0.2",
"@polkadot/wasm-crypto": "7.3.2",
"rxjs": "7.8.1"
},
Expand Down
8 changes: 6 additions & 2 deletions api/src/Balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export class GearBalance extends GearTransaction {
return this._api.createType('Balance', balance.free) as Balance;
}

transfer(to: string, value: number | BN): SubmittableExtrinsic<'promise', ISubmittableResult> {
this.extrinsic = this._api.tx.balances.transfer(to, value);
transfer(
to: string,
value: number | BN,
keepAlive = true,
): SubmittableExtrinsic<'promise', ISubmittableResult> {
this.extrinsic = this._api.tx.balances[keepAlive ? 'transferKeepAlive' : 'transferAllowDeath'](to, value);
return this.extrinsic;
}
}
2 changes: 1 addition & 1 deletion api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@ __metadata:
ts-node: 10.9.2
typescript: 5.4.2
peerDependencies:
"@polkadot/api": 10.12.3
"@polkadot/api": 11.0.2
"@polkadot/wasm-crypto": 7.3.2
rxjs: 7.8.1
languageName: unknown
Expand Down

0 comments on commit 1e688c0

Please sign in to comment.