-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
40 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 |
---|---|---|
|
@@ -6,32 +6,32 @@ on: | |
- beta | ||
|
||
jobs: | ||
install: | ||
name: "Install" | ||
build: | ||
name: "Build" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
- name: "🏗️ Build" | ||
run: yarn build:dapp-example | ||
- name: "📤 Upload artifact" | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./.dapp_example_build | ||
|
||
deploy: | ||
name: "Deploy" | ||
needs: [install] | ||
needs: build | ||
permissions: | ||
pages: write # to deploy to pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "🛎 Checkout" | ||
uses: actions/checkout@v4 | ||
- name: "🔧 Setup" | ||
uses: ./.github/actions/use-dependencies | ||
- name: "🏗️ Build" | ||
run: yarn build:dapp-example | ||
- name: "🚀 Deploy" | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
force_orphan: true # create empty branch if missing | ||
personal_token: ${{ secrets.WRITE_REPOS_TOKEN }} | ||
publish_branch: gh-pages | ||
publish_dir: ./.dapp_example_build | ||
user_name: agoralabs-bot | ||
user_email: [email protected] | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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
29 changes: 29 additions & 0 deletions
29
src/extension/utils/mapAlgorandTransactionToTransaction/parseNote.ts
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,29 @@ | ||
import { decode as decodeBase64 } from '@stablelib/base64'; | ||
import { decode as decodeUtf8 } from '@stablelib/utf8'; | ||
|
||
// types | ||
import type { IBaseOptions } from '@common/types'; | ||
|
||
/** | ||
* Parses the note field. The note field will be encoded in base64 and this function will attempt to decode to UTF-8. If | ||
* the note field is not in UTF-8 format, it gracefully errors and returns null. | ||
* @param {string} encodedNote - The note field encoded in base64. | ||
* @param {IBaseOptions} options - [optional] Base options that include the logger for logging. | ||
* @returns {string | null} The decoded note field or null if UTF-8 decoding failed. | ||
*/ | ||
export default function parseNote( | ||
encodedNote: string, | ||
options?: IBaseOptions | ||
): string | null { | ||
const _functionName = 'parseNote'; | ||
|
||
try { | ||
return decodeUtf8( | ||
decodeBase64(encodedNote) // decode from base64 | ||
); | ||
} catch (error) { | ||
options?.logger?.debug(`${_functionName}: note not encoded in utf-8`); | ||
|
||
return null; | ||
} | ||
} |