-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bump version to 1.5.0 * [Soroban] Add getTokenInvocationArgs function in new workspace (#119) * [Soroban] Add token parsing/formatting functions (#120) * [Soroban] Add scValByType function (#121) * [Soroban] Add GH Action and README (#122) * add tests for moneygram transactions (#123) * Use relative path to access "walletSdk" root folder (#125) * add AuthHeaderSigner (#124) * add AuthHeaderSigner * cmments * fix test * print logs * fix * Cleanup * Update @stellar/typescript-wallet-sdk/src/walletSdk/Auth/AuthHeaderSigner.ts Co-authored-by: Cássio Marcos Goulart <[email protected]> * snake case * add test for checking against example JWT --------- Co-authored-by: Cássio Marcos Goulart <[email protected]> * Add e2e test for testing browser build (#126) * add challengeToken to km header (#127) * add challengeToken to km header * move to dev deps * fix test * [Soroban] Add generic getInvocationDetails helper (#128) * updates BrowserStorageConfigParams method types (#129) * add changelogs, and update package versions to all be in align (#131) * update integration tests readme (#132) * add defaultauthheadersigner test with anchorplatform (#133) * add beta build github action (#135) * add canary build github action * add contributing guide with releasing directions * use timestamp * add top level readme (#136) * add top level readme * update * update * update * update * yarn install * example code * update changelogs (#137) * change to param (#138) --------- Co-authored-by: Alec Charbonneau <[email protected]> Co-authored-by: Cássio Marcos Goulart <[email protected]> Co-authored-by: aristides <[email protected]>
- Loading branch information
1 parent
7c16b49
commit c44d76a
Showing
58 changed files
with
2,089 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: typescript-wallet-sdk beta build | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
jobs: | ||
npm-beta: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
|
||
- run: yarn install | ||
- run: yarn build | ||
- run: yarn test:ci | ||
|
||
- name: Create beta package version | ||
run: | | ||
timestamp=$(date +%s%3N) | ||
current_version=$(jq -r '.version' @stellar/typescript-wallet-sdk/package.json) | ||
echo "new_version=${current_version}-beta.${timestamp}" >> $GITHUB_ENV | ||
- name: Update package.json version | ||
uses: jossef/action-set-json-field@6e6d7e639f24b3955ef682815317b5613ac6ca12 # v1 | ||
with: | ||
file: ./@stellar/typescript-wallet-sdk/package.json | ||
field: version | ||
value: ${{ env.new_version }} | ||
|
||
- name: Publish beta build | ||
run: | | ||
cd @stellar/typescript-wallet-sdk | ||
yarn publish --tag beta --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: npm publish wallet sdk Soroban | ||
on: [workflow_dispatch] | ||
jobs: | ||
npm-publish: | ||
name: npm-publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: yarn install | ||
- run: yarn build | ||
- run: yarn test:ci | ||
|
||
- name: Publish to NPM | ||
run: | | ||
cd @stellar/typescript-wallet-sdk-soroban | ||
yarn publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Playwright Tests | ||
on: [pull_request] | ||
jobs: | ||
playwright: | ||
name: "Playwright e2e Tests" | ||
runs-on: ubuntu-latest | ||
container: | ||
image: mcr.microsoft.com/playwright:v1.43.0-jammy | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
- run: yarn install | ||
- run: yarn build | ||
- run: yarn test:e2e:ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Release notes - Typescript Wallet SDK Key Manager - 1.5.0 | ||
|
||
### Added | ||
* Challenge token to param to auth header | ||
|
||
### Fixed | ||
* Update BrowserStorageConfigParams method types | ||
|
||
# Release notes - Typescript Wallet SDK Key Manager - 1.4.0 | ||
|
||
### Added | ||
* Init to the project, added key manager functionality | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Release notes - Typescript Wallet SDK Key Soroban - 1.5.0 | ||
|
||
### Added | ||
* Init to the project, added soroban functionality | ||
* getTokenInvocationArgs function | ||
* Token parsing/formatting functions | ||
* scValyByType function | ||
* generic getInvocationDetails helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Stellar Typescript Wallet Soroban SDK [![npm version](https://badge.fury.io/js/@stellar%2Ftypescript-wallet-sdk-soroban.svg)](https://badge.fury.io/js/@stellar%2Ftypescript-wallet-sdk-soroban) | ||
|
||
The Typescript Wallet Soroban SDK is a work-in-progress library that (currently) | ||
allows developers to use soroban helpers in their wallet applications. It works | ||
in conjuction with the main | ||
[Typescript Wallet SDK](https://github.com/stellar/typescript-wallet-sdk) to | ||
hold all the functionality a developer would need to create a wallet for the | ||
stellar network. | ||
|
||
## Dependency | ||
|
||
The library is available via npm. To import `typescript-wallet-sdk-soroban` you | ||
need to add it as a dependency to your code: | ||
|
||
yarn: | ||
|
||
```shell | ||
yarn add @stellar/typescript-wallet-sdk-soroban | ||
``` | ||
|
||
npm: | ||
|
||
```shell | ||
npm install @stellar/typescript-wallet-sdk-soroban | ||
``` | ||
|
||
## Introduction | ||
|
||
Here's some examples on how to use the Soroban helpers: | ||
|
||
```typescript | ||
import { | ||
getTokenInvocationArgs, | ||
formatTokenAmount, | ||
parseTokenAmount, | ||
scValByType, | ||
} from "@stellar/typescript-wallet-sdk-soroban"; | ||
|
||
const transaction = TransactionBuilder.fromXDR( | ||
"AAAAAgAAAACM6IR9GHiRoVVAO78JJNksy2fKDQNs2jBn8bacsRLcrDucaFsAAAWIAAAAMQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABHkEVdJ+UfDnWpBr/qF582IEoDQ0iW0WPzO9CEUdvvh8AAAAIdHJhbnNmZXIAAAADAAAAEgAAAAAAAAAAjOiEfRh4kaFVQDu/CSTZLMtnyg0DbNowZ/G2nLES3KwAAAASAAAAAAAAAADoFl2ACT9HZkbCeuaT9MAIdStpdf58wM3P24nl738AnQAAAAoAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAR5BFXSflHw51qQa/6hefNiBKA0NIltFj8zvQhFHb74fAAAACHRyYW5zZmVyAAAAAwAAABIAAAAAAAAAAIzohH0YeJGhVUA7vwkk2SzLZ8oNA2zaMGfxtpyxEtysAAAAEgAAAAAAAAAA6BZdgAk/R2ZGwnrmk/TACHUraXX+fMDNz9uJ5e9/AJ0AAAAKAAAAAAAAAAAAAAAAAAAABQAAAAAAAAABAAAAAAAAAAIAAAAGAAAAAR5BFXSflHw51qQa/6hefNiBKA0NIltFj8zvQhFHb74fAAAAFAAAAAEAAAAHa35L+/RxV6EuJOVk78H5rCN+eubXBWtsKrRxeLnnpRAAAAACAAAABgAAAAEeQRV0n5R8OdakGv+oXnzYgSgNDSJbRY/M70IRR2++HwAAABAAAAABAAAAAgAAAA8AAAAHQmFsYW5jZQAAAAASAAAAAAAAAACM6IR9GHiRoVVAO78JJNksy2fKDQNs2jBn8bacsRLcrAAAAAEAAAAGAAAAAR5BFXSflHw51qQa/6hefNiBKA0NIltFj8zvQhFHb74fAAAAEAAAAAEAAAACAAAADwAAAAdCYWxhbmNlAAAAABIAAAAAAAAAAOgWXYAJP0dmRsJ65pP0wAh1K2l1/nzAzc/bieXvfwCdAAAAAQBkcwsAACBwAAABKAAAAAAAAB1kAAAAAA==", | ||
Networks.FUTURENET, | ||
) as Transaction<Memo<MemoType>, Operation.InvokeHostFunction[]>; | ||
const op = transaction.operations[0]; | ||
|
||
const args = getTokenInvocationArgs(op); | ||
/* | ||
extracts args from the invoke host function operation: | ||
args = { | ||
fnName: "transfer, | ||
contractId: "CAPECFLUT6KHYOOWUQNP7KC6PTMICKANBURFWRMPZTXUEEKHN67B7UI2", | ||
from: "GCGORBD5DB4JDIKVIA536CJE3EWMWZ6KBUBWZWRQM7Y3NHFRCLOKYVAL", | ||
to: "GDUBMXMABE7UOZSGYJ5ONE7UYAEHKK3JOX7HZQGNZ7NYTZPPP4AJ2GQJ", | ||
amount: 5 | ||
} | ||
*/ | ||
|
||
const formattedAmount = formatTokenAmount("10000123", 3); | ||
// converts smart contract token amount into a displayable amount that can be | ||
// used on client UI | ||
// formattedAmount = "10000.123" | ||
|
||
const parsedAmount = parseTokenAmount("10000.123", 3); | ||
// converts an amount to a whole (bigint) number that can be used on | ||
// smart contracts operations | ||
// parsedAmount = 10000123 | ||
|
||
const accountAddress = xdr.ScVal.scvAddress( | ||
xdr.ScAddress.scAddressTypeAccount( | ||
xdr.PublicKey.publicKeyTypeEd25519( | ||
StrKey.decodeEd25519PublicKey( | ||
"GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB", | ||
), | ||
), | ||
), | ||
); | ||
|
||
const addressString = scValByType(accountAddress); | ||
// converts smart contract complex value into a simple string | ||
// addressString = "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const parentConfig = require("../../babel.config"); | ||
|
||
module.exports = { | ||
...parentConfig, | ||
}; |
Oops, something went wrong.