Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Rename safe-kit to sdk-starter-kit #939

Merged
merged 7 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update type changes for SafeKit to SdkStarterKit
  • Loading branch information
dasanra committed Aug 12, 2024
commit aade3999ec931e18cfeb2107c2f4d0cd93df8333
2 changes: 1 addition & 1 deletion packages/sdk-starter-kit/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Safe Kit
# SDK Starter Kit

[![npm Version](https://badge.fury.io/js/%40safe-global%2Fsdk-starter-kit.svg)](https://badge.fury.io/js/%40safe-global%2Fsdk-starter-kit)
[![GitHub Release](https://img.shields.io/github/release/safe-global/safe-core-sdk.svg?style=flat)](https://github.com/safe-global/safe-core-sdk/releases)
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk-starter-kit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import SafeApiKit from '@safe-global/api-kit'

import { SafeClient } from '@safe-global/sdk-starter-kit/SafeClient'
import { isValidAddress, isValidSafeConfig } from '@safe-global/sdk-starter-kit/utils'
import { SafeKitConfig } from '@safe-global/sdk-starter-kit/types'
import { SdkStarterKitConfig } from '@safe-global/sdk-starter-kit/types'

/**
* Initializes a Safe client with the given configuration options.
*
* @param config - The Safe client configuration options.
* @returns A Safe client instance.
*/
export async function createSafeClient(config: SafeKitConfig): Promise<SafeClient> {
export async function createSafeClient(config: SdkStarterKitConfig): Promise<SafeClient> {
const protocolKit = await getProtocolKitInstance(config)
const apiKit = await getApiKitInstance(protocolKit)

Expand All @@ -23,10 +23,10 @@ export async function createSafeClient(config: SafeKitConfig): Promise<SafeClien
/**
* Get the Safe protocol kit instance.
*
* @param config - The Safe kit configuration options.
* @param config - The SDK Starter kit configuration options.
* @returns A protocolKit instance.
*/
async function getProtocolKitInstance(config: SafeKitConfig): Promise<Safe> {
async function getProtocolKitInstance(config: SdkStarterKitConfig): Promise<Safe> {
if (config.safeAddress && isValidAddress(config.safeAddress)) {
// If the safe already exist
return Safe.init({
Expand Down
9 changes: 5 additions & 4 deletions packages/sdk-starter-kit/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,23 @@ export type SafeConfig = {
saltNonce?: string
}

export type ExistingSafeKitConfig = {
export type ExistingSdkStarterKitConfig = {
safeAddress?: string
safeOptions?: never
}

export type PredictedSafeKitConfig = {
export type PredictedSdkStarterKitConfig = {
safeAddress?: never
safeOptions?: SafeConfig
}

export type SafeKitRootConfig = {
export type SdkStarterKitRootConfig = {
provider: SafeProvider['provider']
signer: SafeProvider['signer']
}

export type SafeKitConfig = SafeKitRootConfig & (ExistingSafeKitConfig | PredictedSafeKitConfig)
export type SdkStarterKitConfig = SdkStarterKitRootConfig &
(ExistingSdkStarterKitConfig | PredictedSdkStarterKitConfig)

export type SafeClientResult = {
safeAddress: string
Expand Down
7 changes: 5 additions & 2 deletions playground/config/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const playgroundRelayKitPaths = {
'relay-kit/usdc-transfer-4337-sponsored-counterfactual'
}

const playgroundSafeKitPaths = {
const playgroundStarterKitPaths = {
'send-transactions': 'sdks-starter-kit/send-transactions',
'send-on-chain-message': 'sdk-starter-kit/send-on-chain-message',
'send-off-chain-message': 'sdk-starter-kit/send-off-chain-message',
Expand All @@ -39,7 +39,7 @@ const path =
playgroundProtocolKitPaths[playInput] ||
playgroundApiKitPaths[playInput] ||
playgroundRelayKitPaths[playInput] ||
playgroundSafeKitPaths[playInput]
playgroundStarterKitPaths[playInput]

function printPlaygrounds(playgroundPaths: Record<string, string>) {
const playgroundKits = Object.keys(playgroundPaths)
Expand All @@ -61,6 +61,9 @@ if (!path) {
console.log('RELAY KIT')
printPlaygrounds(playgroundRelayKitPaths)

console.log('SDK STARTER KIT')
printPlaygrounds(playgroundStarterKitPaths)

process.exit()
}

Expand Down
Loading