-
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.
- Loading branch information
cmd
committed
Mar 4, 2024
1 parent
436646b
commit 4acb3bb
Showing
5 changed files
with
53 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { DraftSession } from '@scrow/core' | ||
import { alias, role, signer } from './config.js' | ||
import { agent_draft, secret_id } from '../terms.js' | ||
|
||
/** ========== [ Draft Session ] ========== **/ | ||
|
||
// Create a draft session | ||
const session = new DraftSession(secret_id, signer, { | ||
debug : true, | ||
verbose : true | ||
}) | ||
|
||
session.on('error', console.log) | ||
session.on('reject', console.log) | ||
|
||
// When the session is ready: | ||
session.on('ready', () => { | ||
console.log('alice ready') | ||
// If we are not a member: | ||
if (!session.is_member) { | ||
// Grab the buyer policy from the roles list. | ||
console.log(`fetching role "${role}"...`) | ||
const policy = session.get_role(role) | ||
// Join the session as the buyer. | ||
console.log('joining the session...') | ||
session.join(policy.id) | ||
// Print to console. | ||
console.log(`${alias} joined the draft as role ${policy.title}`) | ||
} | ||
}) | ||
|
||
await session.init('wss://relay.damus.io', agent_draft) |
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 |
---|---|---|
@@ -1,13 +1,9 @@ | ||
import { DraftSession } from '@scrow/core' | ||
|
||
import { signer } from './config.js' | ||
|
||
/** ========== [ Draft Session ] ========== **/ | ||
|
||
// Create a draft session | ||
import { signer } from './config.js' | ||
|
||
console.log(signer.pubkey) | ||
|
||
const drafts = await DraftSession.list('wss://relay.damus.io', signer, { verbose : true }) | ||
const addr = 'wss://relay.damus.io' | ||
const drafts = await DraftSession.list(addr, signer) | ||
|
||
console.dir(drafts, { depth : null }) |
File renamed without changes.
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