Skip to content

Commit

Permalink
Add getOnchainIdentifier in the reference
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniSomoza committed Jan 13, 2025
1 parent c711a0c commit e271cde
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/reference-sdk-protocol-kit/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"messages": "Messages",
"safe-modules": "Safe Modules",
"safe-guards": "Safe Guards",
"fallback-handler": "Fallback Handler"
"fallback-handler": "Fallback Handler",
"onchain-tracking": "On-chain Tracking"
}
3 changes: 3 additions & 0 deletions pages/reference-sdk-protocol-kit/onchain-tracking/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"getOnchainIdentifier": "getOnchainIdentifier"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Tabs } from 'nextra/components'

# `getOnchainIdentifier`

Returns the on-chain identifier generated internally. This identifier is appended to the `data` field of transactions to enable on-chain tracking.

## Usage

{/* <!-- vale off --> */}

<Tabs items={['example.ts', 'setup.ts']}>
<Tabs.Tab>
```typescript
import { protocolKit } from './setup.ts'

const onchainIdentifier = await protocolKit.getOnchainIdentifier()

console.log(onchainIdentifier) // e.g., '5afe006562303761323539616336346466346135306537646561393238383963'
```
</Tabs.Tab>
<Tabs.Tab>
```typescript
import Safe from '@safe-global/protocol-kit'

export const protocolKit = Safe.init({
// ...
onchainAnalytics: {
project: 'Cow Swap', // Specify your project name
platform: 'Web' // Optional platform
}
})
```
</Tabs.Tab>
</Tabs>

{/* <!-- vale on --> */}

## Returns

`string`

The on-chain identifier in hexadecimal format (e.g., `5afe00...`), which includes hashed metadata such as project name, platform, tool, and tool version.

Check failure on line 42 in pages/reference-sdk-protocol-kit/onchain-tracking/getOnchainIdentifier.mdx

View workflow job for this annotation

GitHub Actions / vale-docs

[vale] reported by reviewdog 🐶 [Microsoft.Foreign] Use 'for example' instead of 'e.g.,'. Raw Output: {"message": "[Microsoft.Foreign] Use 'for example' instead of 'e.g.,'.", "location": {"path": "pages/reference-sdk-protocol-kit/onchain-tracking/getOnchainIdentifier.mdx", "range": {"start": {"line": 42, "column": 48}}}, "severity": "ERROR"}

For more details about the identifier format, please refer to the [On-chain identifier](../../sdk/onchain-tracking.mdx#on-chain-identifier-format) section.

0 comments on commit e271cde

Please sign in to comment.